This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Update loop metadata in stripNonLineTableDebugInfo
ClosedPublic

Authored by vsk on Apr 30 2020, 1:32 PM.

Details

Summary

Have stripNonLineTableDebugInfo() attach updated !llvm.loop metadata to
an instruction (instead of updating and then discarding the metadata).

This fixes "!dbg attachment points at wrong subprogram for function"
errors seen while archiving an iOS app.

It would be nice -- as a follow-up -- to catch this issue earlier,
perhaps by modifying the verifier to constrain where DILocations are
allowed. Any alternative suggestions appreciated.

rdar://61982466

Diff Detail

Event Timeline

vsk created this revision.Apr 30 2020, 1:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2020, 1:32 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aprantl accepted this revision.Apr 30 2020, 5:19 PM

Thanks, this looks great!

llvm/lib/IR/DebugInfo.cpp
664

Should we keep a form of the old loop and assert that no other DILocations are hanging off not-yet-handled future metadata?

This revision is now accepted and ready to land.Apr 30 2020, 5:19 PM
vsk marked an inline comment as done.May 1 2020, 9:46 AM
vsk added inline comments.
llvm/lib/IR/DebugInfo.cpp
664

There's a couple places where we'd need to add that assert, so I tried adding a verifier check instead (https://reviews.llvm.org/D79245). If you'd rather we just add a simple assert here that's fine too, lmk what you prefer.

This revision was automatically updated to reflect the committed changes.