Skip to content

Commit f825214

Browse files
committed
[DebugInfo][NFC] Refactor debug intrinsic copy and delete to instead just move
Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D133304
1 parent 3c438f6 commit f825214

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,15 +636,14 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
636636
// Since debug values in the loop have been deleted, inserting an undef
637637
// dbg.value truncates the range of any dbg.value before the loop where the
638638
// loop used to be. This is particularly important for constant values.
639-
DIBuilder DIB(*ExitBlock->getModule());
640639
Instruction *InsertDbgValueBefore = ExitBlock->getFirstNonPHI();
641640
assert(InsertDbgValueBefore &&
642641
"There should be a non-PHI instruction in exit block, else these "
643642
"instructions will have no parent.");
644-
for (auto *DVI : DeadDebugInst)
645-
DIB.insertDbgValueIntrinsic(UndefValue::get(Builder.getInt32Ty()),
646-
DVI->getVariable(), DVI->getExpression(),
647-
DVI->getDebugLoc(), InsertDbgValueBefore);
643+
for (auto *DVI : DeadDebugInst) {
644+
DVI->setUndef();
645+
DVI->moveBefore(InsertDbgValueBefore);
646+
}
648647
}
649648

650649
// Remove the block from the reference counting scheme, so that we can

0 commit comments

Comments
 (0)