This is an archive of the discontinued LLVM Phabricator instance.

[opt] Do not replace MD refs to destroyed constants with undef
ClosedPublic

Authored by StephenTozer on Jan 14 2022, 3:47 AM.

Details

Summary

This patch fixes some incorrect behaviour in Constants.cpp, in which as part of destroying a constant we replace any references to that constant from metadata with an undef value of the same type. This is incorrect for any non-debug-info metadata, and debug info metadata already has RAUW handlers to insert an undef value if the constant is destroyed (and replaced with nullptr).

This resolves the issue introduced in rGe5d958c45629 and mentioned in D108642.

Diff Detail

Event Timeline

StephenTozer created this revision.Jan 14 2022, 3:47 AM
StephenTozer requested review of this revision.Jan 14 2022, 3:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 3:47 AM
aprantl accepted this revision.Jan 18 2022, 3:58 PM

Assuming we already have a test that ensures that the desired debug info behavior keeps working after this patch, this looks good!

This revision is now accepted and ready to land.Jan 18 2022, 3:58 PM
This revision was landed with ongoing or failed builds.Jan 24 2022, 9:39 AM
This revision was automatically updated to reflect the committed changes.