This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Remove debug metadata elements
ClosedPublic

Authored by ellis on Oct 4 2022, 9:38 PM.

Details

Summary

There can be lots of MDTuple debug metadata nodes. For example, globals: !{!1, !2} in !DICompileUnit(). Search through all debug info to find MDTuple's and remove some of their elements.

For D135114 I was able to get a reproducer with 364 lines without manually deleting elements. After this patch I got it down to 67 lines.

Diff Detail

Event Timeline

ellis created this revision.Oct 4 2022, 9:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 9:38 PM
ellis published this revision for review.Oct 4 2022, 9:40 PM
ellis added reviewers: dblaikie, Meinersbur, aeubanks.
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 9:40 PM
dblaikie added inline comments.Oct 5 2022, 12:33 PM
llvm/test/tools/llvm-reduce/remove-debug-info-nodes.ll
15–18

The DILocalVariables don't need {{}} do they?

llvm/test/tools/llvm-reduce/remove-metadata-elements.ll
24
llvm/test/tools/llvm-reduce/remove-named-metadata-elements.ll
7
llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp
104–106
109–110
117–119
ellis added inline comments.Oct 5 2022, 12:56 PM
llvm/test/tools/llvm-reduce/remove-debug-info-nodes.ll
15–18

Hmm I originally added this because I didn't want these lines to match themselves. But I guess after the first iteration the comments will be removed and they wont' match themselves anymore.

The tests pass without them so I'll remove them.

ellis updated this revision to Diff 465515.Oct 5 2022, 12:56 PM

Remove extra {{ }} in tests

ellis edited the summary of this revision. (Show Details)Oct 5 2022, 1:11 PM
dblaikie accepted this revision.Oct 5 2022, 2:43 PM

Seems pretty good to me.

llvm/test/tools/llvm-reduce/remove-debug-info-nodes.ll
15–18

oh, fair point - if that's a common stylistic thing done in other llvm-reduce tests, I don't mind it here

This revision is now accepted and ready to land.Oct 5 2022, 2:43 PM
This revision was landed with ongoing or failed builds.Oct 6 2022, 9:29 AM
This revision was automatically updated to reflect the committed changes.
probinson added inline comments.Oct 6 2022, 12:01 PM
llvm/test/tools/llvm-reduce/remove-debug-info-nodes.ll
15–18

It doesn't come up often, but I've seen it done elsewhere.

sorry to be late to reviewing this, but I think this is overly aggressive. I see verifier failures like scope must have two or three operands after this patch.

https://reviews.llvm.org/D132077 was in the process of being reviewed and basically does this but more targeted with a specific focus on not creating verifier failures (since that's the direction we'd like to take llvm-reduce, not producing verifier failures since that slows down reduction a lot and dumps a lot of output). could we revert this and use the other patch?

ellis added a comment.Oct 6 2022, 1:06 PM

sorry to be late to reviewing this, but I think this is overly aggressive. I see verifier failures like scope must have two or three operands after this patch.

https://reviews.llvm.org/D132077 was in the process of being reviewed and basically does this but more targeted with a specific focus on not creating verifier failures (since that's the direction we'd like to take llvm-reduce, not producing verifier failures since that slows down reduction a lot and dumps a lot of output). could we revert this and use the other patch?

Oh sorry I was not aware of D132077. After a quick look at the summary it looks very similar to this diff. Since D132077 is a better direction, I'll revert my diff. Thanks for letting me know!