diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2023-11-26 21:24:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-26 21:24:29 +0000 |
commit | c672ba7dde3a6ec2f6c89fcb207c9a6a8474cedc (patch) | |
tree | fcd978aedc24c8eb4b68251ad16cdda0310b5ba2 /llvm/lib/Transforms/Scalar/JumpThreading.cpp | |
parent | f4a4e2f85d819f44772b29c12a6cd2b86c14d611 (diff) | |
download | llvm-c672ba7dde3a6ec2f6c89fcb207c9a6a8474cedc.zip llvm-c672ba7dde3a6ec2f6c89fcb207c9a6a8474cedc.tar.gz llvm-c672ba7dde3a6ec2f6c89fcb207c9a6a8474cedc.tar.bz2 |
[DebugInfo][RemoveDIs] Instrument inliner for non-instr debug-info (#72884)
With intrinsics representing debug-info, we just clone all the
intrinsics when inlining a function and don't think about it any
further. With non-instruction debug-info however we need to be a bit
more careful and manually move the debug-info from one place to another.
For the most part, this means keeping a "cursor" during block cloning of
where we last copied debug-info from, and performing debug-info copying
whenever we successfully clone another instruction.
There are several utilities in LLVM for doing this, all of which now
need to manually call cloneDebugInfo. The testing story for this is not
well covered as we could rely on normal instruction-cloning mechanisms
to do all the hard stuff. Thus, I've added a few tests to explicitly
test dbg.value behaviours, ahead of them becoming not-instructions.
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index d7d5034..59a8b8a 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -3118,8 +3118,8 @@ bool JumpThreadingPass::threadGuard(BasicBlock *BB, IntrinsicInst *Guard, if (!isa<PHINode>(&*BI)) ToRemove.push_back(&*BI); - Instruction *InsertionPoint = &*BB->getFirstInsertionPt(); - assert(InsertionPoint && "Empty block?"); + BasicBlock::iterator InsertionPoint = BB->getFirstInsertionPt(); + assert(InsertionPoint != BB->end() && "Empty block?"); // Substitute with Phis & remove. for (auto *Inst : reverse(ToRemove)) { if (!Inst->use_empty()) { @@ -3129,6 +3129,7 @@ bool JumpThreadingPass::threadGuard(BasicBlock *BB, IntrinsicInst *Guard, NewPN->insertBefore(InsertionPoint); Inst->replaceAllUsesWith(NewPN); } + Inst->dropDbgValues(); Inst->eraseFromParent(); } return true; |