This is an archive of the discontinued LLVM Phabricator instance.

[Verifier] Constrain where DILocations may be nested
ClosedPublic

Authored by vsk on May 1 2020, 9:43 AM.

Details

Summary

Constrain which metadata nodes are allowed to be, or contain,
DILocations. This ensures that logic for updating DILocations in a
Module is complete.

Currently, !llvm.loop metadata is the only odd duck which contains
nested DILocations. This has caused problems in the past: some passes
forgot to visit the nested locations, leading to subtly broken debug
info and late verification failures.

If there's a compelling reason for some future metadata to nest
DILocations, we'll need to introduce a generic API for updating the
locations attached to an Instruction before relaxing this check.

Diff Detail

Event Timeline

vsk created this revision.May 1 2020, 9:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2020, 9:43 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
aprantl accepted this revision.May 4 2020, 10:05 AM

This is very useful! Thanks!

llvm/test/Verifier/dilocation-in-wrong-place.ll
9

I didn't know you could just throw in any random identifier there!

This revision is now accepted and ready to land.May 4 2020, 10:05 AM
This revision was automatically updated to reflect the committed changes.