This is an archive of the discontinued LLVM Phabricator instance.

Add pass to strip debug info from MIR
ClosedPublic

Authored by dsanders on Apr 8 2020, 11:40 AM.

Details

Summary

Removes:

  • All LLVM-IR level debug info using StripDebugInfo()
  • All DEBUG_VALUE MachineInstrs
  • All DebugLocs from MachineInstrs

This is a more complete solution than the previous MIRPrinter
option that just causes it to neglect to print debug-locations.

Diff Detail

Event Timeline

dsanders created this revision.Apr 8 2020, 11:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2020, 11:40 AM
vsk accepted this revision.Apr 8 2020, 12:28 PM

Lgtm, thanks!

This revision is now accepted and ready to land.Apr 8 2020, 12:28 PM
dsanders marked an inline comment as done.Apr 8 2020, 2:08 PM
dsanders added inline comments.
llvm/lib/CodeGen/MachineStripDebug.cpp
55

I have one small fixup to make here which is that we should also remove the debugify metadata too. Otherwise mir-debugify can't be run more than once in a pipeline as you end up with an llvm.debugify with >2 operands

dsanders updated this revision to Diff 256358.Apr 9 2020, 12:54 PM

Fix a few issues that came up when injecting into pipelines:

  • Strip debugify metadata as well
  • Strip 'Debug Info Version' module flag
  • Don't strip certain broken DBG_VALUE instructions. AArch64 (incorrectly) inserts one when debug info is not present and tests depend on it.
vsk accepted this revision.Apr 9 2020, 1:15 PM

Still looks good, with minor inline comments.

llvm/lib/CodeGen/MachineStripDebug.cpp
41

Could you file a PR on bugzilla about this test?

66

This should update Changed (not 100% sure, but StripDebugInfo may be a no-op if the function is empty).

74

We probably should update Changed here as well.

dsanders marked 3 inline comments as done.Apr 9 2020, 3:15 PM

Thanks

llvm/lib/CodeGen/MachineStripDebug.cpp
41

Sure

This revision was automatically updated to reflect the committed changes.