diff options
| author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2018-03-09 22:00:10 +0000 |
|---|---|---|
| committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2018-03-09 22:00:10 +0000 |
| commit | 019dd2316d3a2adcf61c0f3ffb5968fed3218494 (patch) | |
| tree | b90aeff32c9695a7158913c04a39fd26e6c20ca5 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
| parent | fa4e63c0d60a5f14379053fd6d05b594f40f91f6 (diff) | |
| download | bcm5719-llvm-019dd2316d3a2adcf61c0f3ffb5968fed3218494.tar.gz bcm5719-llvm-019dd2316d3a2adcf61c0f3ffb5968fed3218494.zip | |
Revert "[Debug] Retain both sets of debug intrinsics in HoistThenElseCodeToIf"
This reverts commit r327175 as problems in debug info generation were shown.
llvm-svn: 327176
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 79c3fc96089..82ef1b91e74 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1254,23 +1254,23 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, BasicBlock::iterator BB2_Itr = BB2->begin(); Instruction *I1 = &*BB1_Itr++, *I2 = &*BB2_Itr++; - BasicBlock *BIParent = BI->getParent(); - - bool Changed = false; - for (;;) { - // Move over debug info from both sides unchanged. - while (isa<DbgInfoIntrinsic>(I1)) { - BIParent->getInstList().splice(BI->getIterator(), BB1->getInstList(), I1); + // Skip debug info if it is not identical. + DbgInfoIntrinsic *DBI1 = dyn_cast<DbgInfoIntrinsic>(I1); + DbgInfoIntrinsic *DBI2 = dyn_cast<DbgInfoIntrinsic>(I2); + if (!DBI1 || !DBI2 || !DBI1->isIdenticalToWhenDefined(DBI2)) { + while (isa<DbgInfoIntrinsic>(I1)) I1 = &*BB1_Itr++; - } - while (isa<DbgInfoIntrinsic>(I2)) { - BIParent->getInstList().splice(BI->getIterator(), BB2->getInstList(), I2); + while (isa<DbgInfoIntrinsic>(I2)) I2 = &*BB2_Itr++; - } + } + if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2) || + (isa<InvokeInst>(I1) && !isSafeToHoistInvoke(BB1, BB2, I1, I2))) + return false; - if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2)) - return Changed; + BasicBlock *BIParent = BI->getParent(); + bool Changed = false; + do { // If we are hoisting the terminator instruction, don't move one (making a // broken BB), instead clone it, and remove BI. if (isa<TerminatorInst>(I1)) @@ -1318,7 +1318,18 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, I1 = &*BB1_Itr++; I2 = &*BB2_Itr++; - } + // Skip debug info if it is not identical. + DbgInfoIntrinsic *DBI1 = dyn_cast<DbgInfoIntrinsic>(I1); + DbgInfoIntrinsic *DBI2 = dyn_cast<DbgInfoIntrinsic>(I2); + if (!DBI1 || !DBI2 || !DBI1->isIdenticalToWhenDefined(DBI2)) { + while (isa<DbgInfoIntrinsic>(I1)) + I1 = &*BB1_Itr++; + while (isa<DbgInfoIntrinsic>(I2)) + I2 = &*BB2_Itr++; + } + } while (I1->isIdenticalToWhenDefined(I2)); + + return true; HoistTerminator: // It may not be possible to hoist an invoke. |

