Page MenuHomePhabricator

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

Authored by TWeaver on Thu, Nov 7, 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.Thu, Nov 7, 4:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Nov 7, 4:54 AM
TWeaver updated this revision to Diff 228219.Thu, Nov 7, 4:58 AM
TWeaver added a subscriber: debug-info.
dstenb added a subscriber: dstenb.Thu, Nov 7, 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.Thu, Nov 7, 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.Thu, Nov 7, 2:27 PM
TWeaver updated this revision to Diff 228429.Fri, Nov 8, 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.Fri, Nov 8, 2:41 PM
This revision was automatically updated to reflect the committed changes.