1 //===-- BasicBlockUtils.cpp - BasicBlock Utilities -------------------------==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This family of functions perform manipulations on basic blocks, and
11 // instructions contained within basic blocks.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
16 #include "llvm/Function.h"
17 #include "llvm/Instructions.h"
18 #include "llvm/IntrinsicInst.h"
19 #include "llvm/Constant.h"
20 #include "llvm/Type.h"
21 #include "llvm/Analysis/AliasAnalysis.h"
22 #include "llvm/Analysis/LoopInfo.h"
23 #include "llvm/Analysis/Dominators.h"
24 #include "llvm/Target/TargetData.h"
25 #include "llvm/Transforms/Utils/Local.h"
26 #include "llvm/Support/ValueHandle.h"
30 /// DeleteDeadBlock - Delete the specified block, which must have no
32 void llvm::DeleteDeadBlock(BasicBlock
*BB
) {
33 assert((pred_begin(BB
) == pred_end(BB
) ||
34 // Can delete self loop.
35 BB
->getSinglePredecessor() == BB
) && "Block is not dead!");
36 TerminatorInst
*BBTerm
= BB
->getTerminator();
38 // Loop through all of our successors and make sure they know that one
39 // of their predecessors is going away.
40 for (unsigned i
= 0, e
= BBTerm
->getNumSuccessors(); i
!= e
; ++i
)
41 BBTerm
->getSuccessor(i
)->removePredecessor(BB
);
43 // Zap all the instructions in the block.
44 while (!BB
->empty()) {
45 Instruction
&I
= BB
->back();
46 // If this instruction is used, replace uses with an arbitrary value.
47 // Because control flow can't get here, we don't care what we replace the
48 // value with. Note that since this block is unreachable, and all values
49 // contained within it must dominate their uses, that all uses will
50 // eventually be removed (they are themselves dead).
52 I
.replaceAllUsesWith(UndefValue::get(I
.getType()));
53 BB
->getInstList().pop_back();
57 BB
->eraseFromParent();
60 /// FoldSingleEntryPHINodes - We know that BB has one predecessor. If there are
61 /// any single-entry PHI nodes in it, fold them away. This handles the case
62 /// when all entries to the PHI nodes in a block are guaranteed equal, such as
63 /// when the block has exactly one predecessor.
64 void llvm::FoldSingleEntryPHINodes(BasicBlock
*BB
) {
65 if (!isa
<PHINode
>(BB
->begin()))
68 while (PHINode
*PN
= dyn_cast
<PHINode
>(BB
->begin())) {
69 if (PN
->getIncomingValue(0) != PN
)
70 PN
->replaceAllUsesWith(PN
->getIncomingValue(0));
72 PN
->replaceAllUsesWith(UndefValue::get(PN
->getType()));
73 PN
->eraseFromParent();
78 /// DeleteDeadPHIs - Examine each PHI in the given block and delete it if it
79 /// is dead. Also recursively delete any operands that become dead as
80 /// a result. This includes tracing the def-use list from the PHI to see if
81 /// it is ultimately unused or if it reaches an unused cycle.
82 void llvm::DeleteDeadPHIs(BasicBlock
*BB
) {
83 // Recursively deleting a PHI may cause multiple PHIs to be deleted
84 // or RAUW'd undef, so use an array of WeakVH for the PHIs to delete.
85 SmallVector
<WeakVH
, 8> PHIs
;
86 for (BasicBlock::iterator I
= BB
->begin();
87 PHINode
*PN
= dyn_cast
<PHINode
>(I
); ++I
)
90 for (unsigned i
= 0, e
= PHIs
.size(); i
!= e
; ++i
)
91 if (PHINode
*PN
= dyn_cast_or_null
<PHINode
>(PHIs
[i
].operator Value
*()))
92 RecursivelyDeleteDeadPHINode(PN
);
95 /// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
96 /// if possible. The return value indicates success or failure.
97 bool llvm::MergeBlockIntoPredecessor(BasicBlock
* BB
, Pass
* P
) {
98 pred_iterator
PI(pred_begin(BB
)), PE(pred_end(BB
));
99 // Can't merge the entry block.
100 if (pred_begin(BB
) == pred_end(BB
)) return false;
102 BasicBlock
*PredBB
= *PI
++;
103 for (; PI
!= PE
; ++PI
) // Search all predecessors, see if they are all same
105 PredBB
= 0; // There are multiple different predecessors...
109 // Can't merge if there are multiple predecessors.
110 if (!PredBB
) return false;
111 // Don't break self-loops.
112 if (PredBB
== BB
) return false;
113 // Don't break invokes.
114 if (isa
<InvokeInst
>(PredBB
->getTerminator())) return false;
116 succ_iterator
SI(succ_begin(PredBB
)), SE(succ_end(PredBB
));
117 BasicBlock
* OnlySucc
= BB
;
118 for (; SI
!= SE
; ++SI
)
119 if (*SI
!= OnlySucc
) {
120 OnlySucc
= 0; // There are multiple distinct successors!
124 // Can't merge if there are multiple successors.
125 if (!OnlySucc
) return false;
127 // Can't merge if there is PHI loop.
128 for (BasicBlock::iterator BI
= BB
->begin(), BE
= BB
->end(); BI
!= BE
; ++BI
) {
129 if (PHINode
*PN
= dyn_cast
<PHINode
>(BI
)) {
130 for (unsigned i
= 0, e
= PN
->getNumIncomingValues(); i
!= e
; ++i
)
131 if (PN
->getIncomingValue(i
) == PN
)
137 // Begin by getting rid of unneeded PHIs.
138 while (PHINode
*PN
= dyn_cast
<PHINode
>(&BB
->front())) {
139 PN
->replaceAllUsesWith(PN
->getIncomingValue(0));
140 BB
->getInstList().pop_front(); // Delete the phi node...
143 // Delete the unconditional branch from the predecessor...
144 PredBB
->getInstList().pop_back();
146 // Move all definitions in the successor to the predecessor...
147 PredBB
->getInstList().splice(PredBB
->end(), BB
->getInstList());
149 // Make all PHI nodes that referred to BB now refer to Pred as their
151 BB
->replaceAllUsesWith(PredBB
);
153 // Inherit predecessors name if it exists.
154 if (!PredBB
->hasName())
155 PredBB
->takeName(BB
);
157 // Finally, erase the old block and update dominator info.
159 if (DominatorTree
* DT
= P
->getAnalysisIfAvailable
<DominatorTree
>()) {
160 DomTreeNode
* DTN
= DT
->getNode(BB
);
161 DomTreeNode
* PredDTN
= DT
->getNode(PredBB
);
164 SmallPtrSet
<DomTreeNode
*, 8> Children(DTN
->begin(), DTN
->end());
165 for (SmallPtrSet
<DomTreeNode
*, 8>::iterator DI
= Children
.begin(),
166 DE
= Children
.end(); DI
!= DE
; ++DI
)
167 DT
->changeImmediateDominator(*DI
, PredDTN
);
174 BB
->eraseFromParent();
180 /// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
181 /// with a value, then remove and delete the original instruction.
183 void llvm::ReplaceInstWithValue(BasicBlock::InstListType
&BIL
,
184 BasicBlock::iterator
&BI
, Value
*V
) {
185 Instruction
&I
= *BI
;
186 // Replaces all of the uses of the instruction with uses of the value
187 I
.replaceAllUsesWith(V
);
189 // Make sure to propagate a name if there is one already.
190 if (I
.hasName() && !V
->hasName())
193 // Delete the unnecessary instruction now...
198 /// ReplaceInstWithInst - Replace the instruction specified by BI with the
199 /// instruction specified by I. The original instruction is deleted and BI is
200 /// updated to point to the new instruction.
202 void llvm::ReplaceInstWithInst(BasicBlock::InstListType
&BIL
,
203 BasicBlock::iterator
&BI
, Instruction
*I
) {
204 assert(I
->getParent() == 0 &&
205 "ReplaceInstWithInst: Instruction already inserted into basic block!");
207 // Insert the new instruction into the basic block...
208 BasicBlock::iterator New
= BIL
.insert(BI
, I
);
210 // Replace all uses of the old instruction, and delete it.
211 ReplaceInstWithValue(BIL
, BI
, I
);
213 // Move BI back to point to the newly inserted instruction
217 /// ReplaceInstWithInst - Replace the instruction specified by From with the
218 /// instruction specified by To.
220 void llvm::ReplaceInstWithInst(Instruction
*From
, Instruction
*To
) {
221 BasicBlock::iterator
BI(From
);
222 ReplaceInstWithInst(From
->getParent()->getInstList(), BI
, To
);
225 /// RemoveSuccessor - Change the specified terminator instruction such that its
226 /// successor SuccNum no longer exists. Because this reduces the outgoing
227 /// degree of the current basic block, the actual terminator instruction itself
228 /// may have to be changed. In the case where the last successor of the block
229 /// is deleted, a return instruction is inserted in its place which can cause a
230 /// surprising change in program behavior if it is not expected.
232 void llvm::RemoveSuccessor(TerminatorInst
*TI
, unsigned SuccNum
) {
233 assert(SuccNum
< TI
->getNumSuccessors() &&
234 "Trying to remove a nonexistant successor!");
236 // If our old successor block contains any PHI nodes, remove the entry in the
237 // PHI nodes that comes from this branch...
239 BasicBlock
*BB
= TI
->getParent();
240 TI
->getSuccessor(SuccNum
)->removePredecessor(BB
);
242 TerminatorInst
*NewTI
= 0;
243 switch (TI
->getOpcode()) {
244 case Instruction::Br
:
245 // If this is a conditional branch... convert to unconditional branch.
246 if (TI
->getNumSuccessors() == 2) {
247 cast
<BranchInst
>(TI
)->setUnconditionalDest(TI
->getSuccessor(1-SuccNum
));
248 } else { // Otherwise convert to a return instruction...
251 // Create a value to return... if the function doesn't return null...
252 if (BB
->getParent()->getReturnType() != Type::VoidTy
)
253 RetVal
= Constant::getNullValue(BB
->getParent()->getReturnType());
255 // Create the return...
256 NewTI
= ReturnInst::Create(RetVal
);
260 case Instruction::Invoke
: // Should convert to call
261 case Instruction::Switch
: // Should remove entry
263 case Instruction::Ret
: // Cannot happen, has no successors!
264 assert(0 && "Unhandled terminator instruction type in RemoveSuccessor!");
268 if (NewTI
) // If it's a different instruction, replace.
269 ReplaceInstWithInst(TI
, NewTI
);
272 /// SplitEdge - Split the edge connecting specified block. Pass P must
274 BasicBlock
*llvm::SplitEdge(BasicBlock
*BB
, BasicBlock
*Succ
, Pass
*P
) {
275 TerminatorInst
*LatchTerm
= BB
->getTerminator();
276 unsigned SuccNum
= 0;
278 unsigned e
= LatchTerm
->getNumSuccessors();
280 for (unsigned i
= 0; ; ++i
) {
281 assert(i
!= e
&& "Didn't find edge?");
282 if (LatchTerm
->getSuccessor(i
) == Succ
) {
288 // If this is a critical edge, let SplitCriticalEdge do it.
289 if (SplitCriticalEdge(BB
->getTerminator(), SuccNum
, P
))
290 return LatchTerm
->getSuccessor(SuccNum
);
292 // If the edge isn't critical, then BB has a single successor or Succ has a
293 // single pred. Split the block.
294 BasicBlock::iterator SplitPoint
;
295 if (BasicBlock
*SP
= Succ
->getSinglePredecessor()) {
296 // If the successor only has a single pred, split the top of the successor
298 assert(SP
== BB
&& "CFG broken");
300 return SplitBlock(Succ
, Succ
->begin(), P
);
302 // Otherwise, if BB has a single successor, split it at the bottom of the
304 assert(BB
->getTerminator()->getNumSuccessors() == 1 &&
305 "Should have a single succ!");
306 return SplitBlock(BB
, BB
->getTerminator(), P
);
310 /// SplitBlock - Split the specified block at the specified instruction - every
311 /// thing before SplitPt stays in Old and everything starting with SplitPt moves
312 /// to a new block. The two blocks are joined by an unconditional branch and
313 /// the loop info is updated.
315 BasicBlock
*llvm::SplitBlock(BasicBlock
*Old
, Instruction
*SplitPt
, Pass
*P
) {
316 BasicBlock::iterator SplitIt
= SplitPt
;
317 while (isa
<PHINode
>(SplitIt
))
319 BasicBlock
*New
= Old
->splitBasicBlock(SplitIt
, Old
->getName()+".split");
321 // The new block lives in whichever loop the old one did.
322 if (LoopInfo
* LI
= P
->getAnalysisIfAvailable
<LoopInfo
>())
323 if (Loop
*L
= LI
->getLoopFor(Old
))
324 L
->addBasicBlockToLoop(New
, LI
->getBase());
326 if (DominatorTree
*DT
= P
->getAnalysisIfAvailable
<DominatorTree
>())
328 // Old dominates New. New node domiantes all other nodes dominated by Old.
329 DomTreeNode
*OldNode
= DT
->getNode(Old
);
330 std::vector
<DomTreeNode
*> Children
;
331 for (DomTreeNode::iterator I
= OldNode
->begin(), E
= OldNode
->end();
333 Children
.push_back(*I
);
335 DomTreeNode
*NewNode
= DT
->addNewBlock(New
,Old
);
337 for (std::vector
<DomTreeNode
*>::iterator I
= Children
.begin(),
338 E
= Children
.end(); I
!= E
; ++I
)
339 DT
->changeImmediateDominator(*I
, NewNode
);
342 if (DominanceFrontier
*DF
= P
->getAnalysisIfAvailable
<DominanceFrontier
>())
349 /// SplitBlockPredecessors - This method transforms BB by introducing a new
350 /// basic block into the function, and moving some of the predecessors of BB to
351 /// be predecessors of the new block. The new predecessors are indicated by the
352 /// Preds array, which has NumPreds elements in it. The new block is given a
353 /// suffix of 'Suffix'.
355 /// This currently updates the LLVM IR, AliasAnalysis, DominatorTree and
356 /// DominanceFrontier, but no other analyses.
357 BasicBlock
*llvm::SplitBlockPredecessors(BasicBlock
*BB
,
358 BasicBlock
*const *Preds
,
359 unsigned NumPreds
, const char *Suffix
,
361 // Create new basic block, insert right before the original block.
363 BasicBlock::Create(BB
->getName()+Suffix
, BB
->getParent(), BB
);
365 // The new block unconditionally branches to the old block.
366 BranchInst
*BI
= BranchInst::Create(BB
, NewBB
);
368 // Move the edges from Preds to point to NewBB instead of BB.
369 for (unsigned i
= 0; i
!= NumPreds
; ++i
)
370 Preds
[i
]->getTerminator()->replaceUsesOfWith(BB
, NewBB
);
372 // Update dominator tree and dominator frontier if available.
373 DominatorTree
*DT
= P
? P
->getAnalysisIfAvailable
<DominatorTree
>() : 0;
375 DT
->splitBlock(NewBB
);
376 if (DominanceFrontier
*DF
= P
? P
->getAnalysisIfAvailable
<DominanceFrontier
>():0)
377 DF
->splitBlock(NewBB
);
378 AliasAnalysis
*AA
= P
? P
->getAnalysisIfAvailable
<AliasAnalysis
>() : 0;
381 // Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
382 // node becomes an incoming value for BB's phi node. However, if the Preds
383 // list is empty, we need to insert dummy entries into the PHI nodes in BB to
384 // account for the newly created predecessor.
386 // Insert dummy values as the incoming value.
387 for (BasicBlock::iterator I
= BB
->begin(); isa
<PHINode
>(I
); ++I
)
388 cast
<PHINode
>(I
)->addIncoming(UndefValue::get(I
->getType()), NewBB
);
392 // Otherwise, create a new PHI node in NewBB for each PHI node in BB.
393 for (BasicBlock::iterator I
= BB
->begin(); isa
<PHINode
>(I
); ) {
394 PHINode
*PN
= cast
<PHINode
>(I
++);
396 // Check to see if all of the values coming in are the same. If so, we
397 // don't need to create a new PHI node.
398 Value
*InVal
= PN
->getIncomingValueForBlock(Preds
[0]);
399 for (unsigned i
= 1; i
!= NumPreds
; ++i
)
400 if (InVal
!= PN
->getIncomingValueForBlock(Preds
[i
])) {
406 // If all incoming values for the new PHI would be the same, just don't
407 // make a new PHI. Instead, just remove the incoming values from the old
409 for (unsigned i
= 0; i
!= NumPreds
; ++i
)
410 PN
->removeIncomingValue(Preds
[i
], false);
412 // If the values coming into the block are not the same, we need a PHI.
413 // Create the new PHI node, insert it into NewBB at the end of the block
415 PHINode::Create(PN
->getType(), PN
->getName()+".ph", BI
);
416 if (AA
) AA
->copyValue(PN
, NewPHI
);
418 // Move all of the PHI values for 'Preds' to the new PHI.
419 for (unsigned i
= 0; i
!= NumPreds
; ++i
) {
420 Value
*V
= PN
->removeIncomingValue(Preds
[i
], false);
421 NewPHI
->addIncoming(V
, Preds
[i
]);
426 // Add an incoming value to the PHI node in the loop for the preheader
428 PN
->addIncoming(InVal
, NewBB
);
430 // Check to see if we can eliminate this phi node.
431 if (Value
*V
= PN
->hasConstantValue(DT
!= 0)) {
432 Instruction
*I
= dyn_cast
<Instruction
>(V
);
433 if (!I
|| DT
== 0 || DT
->dominates(I
, PN
)) {
434 PN
->replaceAllUsesWith(V
);
435 if (AA
) AA
->deleteValue(PN
);
436 PN
->eraseFromParent();
444 /// FindFunctionBackedges - Analyze the specified function to find all of the
445 /// loop backedges in the function and return them. This is a relatively cheap
446 /// (compared to computing dominators and loop info) analysis.
448 /// The output is added to Result, as pairs of <from,to> edge info.
449 void llvm::FindFunctionBackedges(const Function
&F
,
450 SmallVectorImpl
<std::pair
<const BasicBlock
*,const BasicBlock
*> > &Result
) {
451 const BasicBlock
*BB
= &F
.getEntryBlock();
452 if (succ_begin(BB
) == succ_end(BB
))
455 SmallPtrSet
<const BasicBlock
*, 8> Visited
;
456 SmallVector
<std::pair
<const BasicBlock
*, succ_const_iterator
>, 8> VisitStack
;
457 SmallPtrSet
<const BasicBlock
*, 8> InStack
;
460 VisitStack
.push_back(std::make_pair(BB
, succ_begin(BB
)));
463 std::pair
<const BasicBlock
*, succ_const_iterator
> &Top
= VisitStack
.back();
464 const BasicBlock
*ParentBB
= Top
.first
;
465 succ_const_iterator
&I
= Top
.second
;
467 bool FoundNew
= false;
468 while (I
!= succ_end(ParentBB
)) {
470 if (Visited
.insert(BB
)) {
474 // Successor is in VisitStack, it's a back edge.
475 if (InStack
.count(BB
))
476 Result
.push_back(std::make_pair(ParentBB
, BB
));
480 // Go down one level if there is a unvisited successor.
482 VisitStack
.push_back(std::make_pair(BB
, succ_begin(BB
)));
485 InStack
.erase(VisitStack
.pop_back_val().first
);
487 } while (!VisitStack
.empty());
494 /// AreEquivalentAddressValues - Test if A and B will obviously have the same
495 /// value. This includes recognizing that %t0 and %t1 will have the same
496 /// value in code like this:
497 /// %t0 = getelementptr \@a, 0, 3
498 /// store i32 0, i32* %t0
499 /// %t1 = getelementptr \@a, 0, 3
500 /// %t2 = load i32* %t1
502 static bool AreEquivalentAddressValues(const Value
*A
, const Value
*B
) {
503 // Test if the values are trivially equivalent.
504 if (A
== B
) return true;
506 // Test if the values come form identical arithmetic instructions.
507 if (isa
<BinaryOperator
>(A
) || isa
<CastInst
>(A
) ||
508 isa
<PHINode
>(A
) || isa
<GetElementPtrInst
>(A
))
509 if (const Instruction
*BI
= dyn_cast
<Instruction
>(B
))
510 if (cast
<Instruction
>(A
)->isIdenticalTo(BI
))
513 // Otherwise they may not be equivalent.
517 /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at the
518 /// instruction before ScanFrom) checking to see if we have the value at the
519 /// memory address *Ptr locally available within a small number of instructions.
520 /// If the value is available, return it.
522 /// If not, return the iterator for the last validated instruction that the
523 /// value would be live through. If we scanned the entire block and didn't find
524 /// something that invalidates *Ptr or provides it, ScanFrom would be left at
525 /// begin() and this returns null. ScanFrom could also be left
527 /// MaxInstsToScan specifies the maximum instructions to scan in the block. If
528 /// it is set to 0, it will scan the whole block. You can also optionally
529 /// specify an alias analysis implementation, which makes this more precise.
530 Value
*llvm::FindAvailableLoadedValue(Value
*Ptr
, BasicBlock
*ScanBB
,
531 BasicBlock::iterator
&ScanFrom
,
532 unsigned MaxInstsToScan
,
534 if (MaxInstsToScan
== 0) MaxInstsToScan
= ~0U;
536 // If we're using alias analysis to disambiguate get the size of *Ptr.
537 unsigned AccessSize
= 0;
539 const Type
*AccessTy
= cast
<PointerType
>(Ptr
->getType())->getElementType();
540 AccessSize
= AA
->getTargetData().getTypeStoreSizeInBits(AccessTy
);
543 while (ScanFrom
!= ScanBB
->begin()) {
544 // We must ignore debug info directives when counting (otherwise they
545 // would affect codegen).
546 Instruction
*Inst
= --ScanFrom
;
547 if (isa
<DbgInfoIntrinsic
>(Inst
))
549 // We skip pointer-to-pointer bitcasts, which are NOPs.
550 // It is necessary for correctness to skip those that feed into a
551 // llvm.dbg.declare, as these are not present when debugging is off.
552 if (isa
<BitCastInst
>(Inst
) && isa
<PointerType
>(Inst
->getType()))
555 // Restore ScanFrom to expected value in case next test succeeds
558 // Don't scan huge blocks.
559 if (MaxInstsToScan
-- == 0) return 0;
562 // If this is a load of Ptr, the loaded value is available.
563 if (LoadInst
*LI
= dyn_cast
<LoadInst
>(Inst
))
564 if (AreEquivalentAddressValues(LI
->getOperand(0), Ptr
))
567 if (StoreInst
*SI
= dyn_cast
<StoreInst
>(Inst
)) {
568 // If this is a store through Ptr, the value is available!
569 if (AreEquivalentAddressValues(SI
->getOperand(1), Ptr
))
570 return SI
->getOperand(0);
572 // If Ptr is an alloca and this is a store to a different alloca, ignore
573 // the store. This is a trivial form of alias analysis that is important
574 // for reg2mem'd code.
575 if ((isa
<AllocaInst
>(Ptr
) || isa
<GlobalVariable
>(Ptr
)) &&
576 (isa
<AllocaInst
>(SI
->getOperand(1)) ||
577 isa
<GlobalVariable
>(SI
->getOperand(1))))
580 // If we have alias analysis and it says the store won't modify the loaded
581 // value, ignore the store.
583 (AA
->getModRefInfo(SI
, Ptr
, AccessSize
) & AliasAnalysis::Mod
) == 0)
586 // Otherwise the store that may or may not alias the pointer, bail out.
591 // If this is some other instruction that may clobber Ptr, bail out.
592 if (Inst
->mayWriteToMemory()) {
593 // If alias analysis claims that it really won't modify the load,
596 (AA
->getModRefInfo(Inst
, Ptr
, AccessSize
) & AliasAnalysis::Mod
) == 0)
599 // May modify the pointer, bail out.
605 // Got to the start of the block, we didn't find it, but are done for this
610 /// CopyPrecedingStopPoint - If I is immediately preceded by a StopPoint,
611 /// make a copy of the stoppoint before InsertPos (presumably before copying
613 void llvm::CopyPrecedingStopPoint(Instruction
*I
,
614 BasicBlock::iterator InsertPos
) {
615 if (I
!= I
->getParent()->begin()) {
616 BasicBlock::iterator BBI
= I
; --BBI
;
617 if (DbgStopPointInst
*DSPI
= dyn_cast
<DbgStopPointInst
>(BBI
)) {
618 CallInst
*newDSPI
= DSPI
->clone();
619 newDSPI
->insertBefore(InsertPos
);