This is an archive of the discontinued LLVM Phabricator instance.

Attempt to Salvage Debug Info or undef intrinsics when dropping trivially deletable instructions in reassociate pass
ClosedPublic

Authored by TWeaver on Nov 7 2019, 4:54 AM.

Details

Summary

Fix for BZ38753 - https://bugs.llvm.org/show_bug.cgi?id=38753

Reassociate Expressions pass made no attempt to salvage or "fix up" debug info when dropping trivially delete-able instructions.

This was causing intrinsics that previously pointed to locations to have "dangling" locations that would be fixed up to empty metadata. Later passes would then remove these useless intrinsics. When we eventually reach the back-end, in LLC, LiveDebugValues would then propogate earlier intrinsics into as many blocks as possible. This would cause stale values to be seen in the debugger when debugging optmized code.

There's two test cases, one for undefs and another for a simple salvage case.

Thank you for your time reviewing this patch.

Tom W

Diff Detail

Event Timeline

TWeaver created this revision.Nov 7 2019, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2019, 4:54 AM
TWeaver updated this revision to Diff 228219.Nov 7 2019, 4:58 AM
TWeaver added a subscriber: debug-info.
dstenb added a subscriber: dstenb.Nov 7 2019, 6:41 AM

If D69809 lands before this patch, then you can use the helper function salvageDebugInfoOrMarkUndef() which the former introduces.

If D69809 lands before this patch, then you can use the helper function salvageDebugInfoOrMarkUndef() which the former introduces.

Oh that'd be great, I'll hold off until that goes through then and touch this patch up to use the new helper. thanks for the shout out!

vsk accepted this revision.Nov 7 2019, 2:27 PM

Looks great to me, assuming the plan is to use the 'salvageDebugInfoOrMarkUndef' helper (now available). Thanks!

This revision is now accepted and ready to land.Nov 7 2019, 2:27 PM
TWeaver updated this revision to Diff 228429.Nov 8 2019, 6:01 AM

updated to use newly added helper function for salvage or undeffing behaviour when dropping instructions in reassociate expressions pass.

aprantl accepted this revision.Nov 8 2019, 2:41 PM
This revision was automatically updated to reflect the committed changes.
TWeaver updated this revision to Diff 264631.May 18 2020, 8:21 AM

Updated diff to correct revision for easing future historical searches