diff options
author | Jeremy Morse <jeremy.morse.llvm@gmail.com> | 2019-01-14 12:13:12 +0000 |
---|---|---|
committer | Jeremy Morse <jeremy.morse.llvm@gmail.com> | 2019-01-14 12:13:12 +0000 |
commit | f216da7ee01d6fe7ec85ee1dfcd215e223d4e66b (patch) | |
tree | 732ddfd1475010ca67d36bbdfc6d89f31fe7bf51 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 67610926fc74d03061da2c1ce4c895d17bee236f (diff) | |
download | bcm5719-llvm-f216da7ee01d6fe7ec85ee1dfcd215e223d4e66b.tar.gz bcm5719-llvm-f216da7ee01d6fe7ec85ee1dfcd215e223d4e66b.zip |
[DebugInfo] Remove un-necessary logic from HoistThenElseCodeToIf
Following PR39807, the way in which SimplifyCFG hoists common code on
branch paths was fixed in r347782. However this left extra code hanging
around HoistThenElseCodeToIf that wasn't necessary and needlessly
complicated matters -- we no longer need to look up through the 'if'
basic block to find a location for hoisted 'select' insts, we can instead
use the location chosen by applyMergedLocation.
This patch deletes that extra logic, and updates a regression test to
reflect the new logic (selects get the merged location, not a previous
insts location).
Differential Revision: https://reviews.llvm.org/D55272
llvm-svn: 351058
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index ac09ce5a347..03b73954321 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1373,14 +1373,6 @@ HoistTerminator: } } - // As the parent basic block terminator is a branch instruction which is - // removed at the end of the current transformation, use its previous - // non-debug instruction, as the reference insertion point, which will - // provide the debug location for generated select instructions. For BBs - // with only debug instructions, use an empty debug location. - Instruction *InsertPt = - BIParent->getTerminator()->getPrevNonDebugInstruction(); - // Okay, it is safe to hoist the terminator. Instruction *NT = I1->clone(); BIParent->getInstList().insert(BI->getIterator(), NT); @@ -1394,11 +1386,8 @@ HoistTerminator: // it involves inlinable calls. NT->applyMergedLocation(I1->getDebugLoc(), I2->getDebugLoc()); + // PHIs created below will adopt NT's merged DebugLoc. IRBuilder<NoFolder> Builder(NT); - // If an earlier instruction in this BB had a location, adopt it, otherwise - // clear debug locations. - Builder.SetCurrentDebugLocation(InsertPt ? InsertPt->getDebugLoc() - : DebugLoc()); // Hoisting one of the terminators from our successor is a great thing. // Unfortunately, the successors of the if/else blocks may have PHI nodes in |