aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorOCHyams <orlando.hyams@sony.com>2022-10-20 14:17:47 +0100
committerOCHyams <orlando.hyams@sony.com>2022-10-20 15:12:49 +0100
commitf825214411a0f014950b644f789ed478f534bda2 (patch)
tree8a8deb017869fe3b38777777829169cff1a882cd /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent3c438f611986651083d77b0537dc129e7575bc2a (diff)
downloadllvm-f825214411a0f014950b644f789ed478f534bda2.zip
llvm-f825214411a0f014950b644f789ed478f534bda2.tar.gz
llvm-f825214411a0f014950b644f789ed478f534bda2.tar.bz2
[DebugInfo][NFC] Refactor debug intrinsic copy and delete to instead just move
Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D133304
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 75a755c..c007a59 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -636,15 +636,14 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
// Since debug values in the loop have been deleted, inserting an undef
// dbg.value truncates the range of any dbg.value before the loop where the
// loop used to be. This is particularly important for constant values.
- DIBuilder DIB(*ExitBlock->getModule());
Instruction *InsertDbgValueBefore = ExitBlock->getFirstNonPHI();
assert(InsertDbgValueBefore &&
"There should be a non-PHI instruction in exit block, else these "
"instructions will have no parent.");
- for (auto *DVI : DeadDebugInst)
- DIB.insertDbgValueIntrinsic(UndefValue::get(Builder.getInt32Ty()),
- DVI->getVariable(), DVI->getExpression(),
- DVI->getDebugLoc(), InsertDbgValueBefore);
+ for (auto *DVI : DeadDebugInst) {
+ DVI->setUndef();
+ DVI->moveBefore(InsertDbgValueBefore);
+ }
}
// Remove the block from the reference counting scheme, so that we can