This is an archive of the discontinued LLVM Phabricator instance.

[Assignment Tracking][22/*] Add loop-deletion test
ClosedPublic

Authored by Orlando on Sep 5 2022, 8:49 AM.

Details

Summary

Check that dbg.assign intrinsics are not accidently converted into dbg.value intrinsics.

Diff Detail

Event Timeline

Orlando created this revision.Sep 5 2022, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2022, 8:49 AM
Orlando requested review of this revision.Sep 5 2022, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2022, 8:49 AM
jmorse accepted this revision.Sep 13 2022, 2:42 AM
jmorse added a subscriber: jmorse.

LGTM with nit.

I find the reproducer utterly fascinating -- because of the leak, the variable is partially promoted, and the store in the condition block dominates the leak site so there's no loop-exit-PHI that a dbg.value gets attached to. Instead the last dbg.value is inside the loop, and gets set to undef when the loop is loop-reduced away. LowerDbgDeclare has a partial save by instrumenting the call site, but that's something dbg.assign does better.

Will this stop working if the fix to TryToSimplifyUncondBranchFromEmptyBlock in D133310 doesn't land?

llvm/test/DebugInfo/Generic/assignment-tracking/loop-deletion/dead-loop.ll
22

I'd suggest more detail in what the operands to dbg.assign are, just to confirm it isn't stripped of all information. Ensuring it still refers to the alloca would be good.

This revision is now accepted and ready to land.Sep 13 2022, 2:42 AM

(One wonders why the dbg.values get set to undef when the sunk store still retains a value -- possibly the PHI put in by lcssa gets RAUW'd but the source value doesn't? This raises the possibility that scenarios like this might benefit from forward salvaging, i.e. "we know this value is dead, but something using it isn't, so re-point the dbg intrinsics at that).

This revision was landed with ongoing or failed builds.Nov 15 2022, 6:57 AM
This revision was automatically updated to reflect the committed changes.
Orlando marked an inline comment as done.

I tidied up the test a little before landing