[PATCH] D140404: Patch for dbg variable instrinsics to point towards cloned values in JumpThreading
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 03:40:15 PST 2023
uabelho added a comment.
In D140404#4109678 <https://reviews.llvm.org/D140404#4109678>, @jmorse wrote:
> /me squints -- I think the idea here was that if SSAUpdater has a value at the end of the block we can use that and it won't cause new codegen; but then we're using `GetValueInMiddleOfBlock`, which will generate code in certain circumstances.
>
> @StephenTozer @BenJMudd Presumably we can just use GetValueAtEndOfBlock as this isn't a general SSA update query, we have a guarantee that only blocks outside of the the (threaded) value definitions will be updated, where there's no need to consider definitions in the middle of the block.
I just did a quick test to do
void SSAUpdater::UpdateDebugValue(Instruction *I, DbgValueInst *DbgValue) {
BasicBlock *UserBB = DbgValue->getParent();
if (HasValueForBlock(UserBB)) {
- Value *NewVal = GetValueInMiddleOfBlock(UserBB);
+ Value *NewVal = GetValueAtEndOfBlock(UserBB);
DbgValue->replaceVariableLocationOp(I, NewVal);
}
else
DbgValue->setKillLocation();
}
and then the difference I saw with/without debug info disappears.
I don't know anything about this, just wanted to let you know your suggestion indeed seems to work.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140404/new/
https://reviews.llvm.org/D140404
More information about the llvm-commits
mailing list