summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index 455916eeb82..b6e7c9f404e 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -402,11 +402,12 @@ SkipTopCFIAndReturn:
// the CFI instruction. Later on, this leads to BB2 being 'hacked off' at the
// wrong place (in ReplaceTailWithBranchTo()) which results in losing this CFI
// instruction.
- while (I1 != MBB1->end() && I1->isCFIInstruction()) {
+ // Skip CFI_INSTRUCTION and debugging instruction; necessary to avoid changing the code.
+ while (I1 != MBB1->end() && !countsAsInstruction(*I1)) {
++I1;
}
- while (I2 != MBB2->end() && I2->isCFIInstruction()) {
+ while (I2 != MBB2->end() && !countsAsInstruction(*I2)) {
++I2;
}
OpenPOWER on IntegriCloud