summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index b8bac6d..925e3e9 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1069,9 +1069,12 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
}
// If we get here, we can hoist the instruction. Try to place it
- // before the icmp instruction preceeding the conditional branch.
+ // before the icmp instruction preceding the conditional branch.
BasicBlock::iterator InsertPos = BI;
- if (InsertPos != BIParent->begin())
+ if (InsertPos != BIParent->begin())
+ --InsertPos;
+ // Skip debug info between condition and branch.
+ while (InsertPos != BIParent->begin() && isa<DbgInfoIntrinsic>(InsertPos))
--InsertPos;
if (InsertPos == BrCond && !isa<PHINode>(BrCond)) {
SmallPtrSet<Instruction *, 4> BB1Insns;