This is an archive of the discontinued LLVM Phabricator instance.

[Assignment Tracking] Fix DbgVariableIntrinsic::replaceVariableLocationOp
ClosedPublic

Authored by Orlando on Nov 23 2022, 4:15 AM.

Details

Summary

Fix replaceVariableLocationOp unconditionally replacing the first operand of a dbg.assign.


FYI this bug / mistake was introduced when rebasing the patch that added the change. I've added a unittest test for it.

Diff Detail

Event Timeline

Orlando created this revision.Nov 23 2022, 4:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 4:15 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Orlando requested review of this revision.Nov 23 2022, 4:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 4:15 AM

LGTM with minor comments.

llvm/unittests/IR/DebugInfoTest.cpp
405–406

YMMV, but while we're confirming one we may as well confirm the other?

417

Might be worth also adding a test that it correctly asserts when trying to replace a value that does not appear in the address or value?

StephenTozer added inline comments.Nov 23 2022, 5:03 AM
llvm/unittests/IR/DebugInfoTest.cpp
417

Rescinding this comment, testing the assert is probably not necessary in this case.

Orlando updated this revision to Diff 477478.Nov 23 2022, 5:29 AM
Orlando marked an inline comment as done.

+ Address comment

Orlando updated this revision to Diff 477479.Nov 23 2022, 5:31 AM

Oops - use correct Value in the new ASSERT check.

jryans accepted this revision.Nov 23 2022, 5:31 AM

Looks reasonable to me, thanks! 😄

This revision is now accepted and ready to land.Nov 23 2022, 5:31 AM
This revision was landed with ongoing or failed builds.Nov 23 2022, 5:57 AM
This revision was automatically updated to reflect the committed changes.

Thank you both