Page MenuHomePhabricator

[IRSim][IROutliner] Adding DebugInfo handling for IR outlined functions.
Needs ReviewPublic

Authored by AndrewLitteken on Sep 8 2020, 10:33 AM.

Details

Reviewers
paquette
Summary

Including debug instructions from different places in the program could cause issues with debuggers. This makes sure that any debug information about original location in outlined functions is stripped accordingly, and adds new debug information to the outlined functions.

Tests Changed:

  • llvm/test/Transforms/IROutliner/legal-debug.ll

New Tests:

  • llvm/test/DebugInfo/AArch64/ir-outliner.ll

Diff Detail

Event Timeline

AndrewLitteken created this revision.Sep 8 2020, 10:33 AM

I know almost nothing about how DebugInfo is represented in llvm/dwarf, but is there not a way to represent what this transformation is doing in DI? It's always a little sad when you have to drop it, since doing so makes the debug experience worse.

llvm/lib/Transforms/IPO/IROutliner.cpp
314

is the StringRef() ctor call necessary?

353

where does moveFunctionData get called with MoveDebug set the other way?

aprantl added a subscriber: vsk.

Updating for string refs.

vsk added a comment.Sep 16 2020, 9:58 AM

CodeExtractor contains a utility to fix up debug info after extraction occurs (I believe it's called fixupDebugInfoPostExtraction). It's solving the same problem - is there any way to generalize/reuse that logic?

llvm/test/DebugInfo/AArch64/ir-outliner.ll
2

Please validate the debug info metadata in the IR after -iroutliner runs. Validating the final DWARF production is nice, but checking the IR takes precedent (why? well DWARF may not represent everything we care about at the IR level, and DWARF isn't the only debug info format llvm supports).