This is an archive of the discontinued LLVM Phabricator instance.

[CodeExtractor] Transfer debug info to extracted function
ClosedPublic

Authored by vsk on Jan 15 2020, 12:50 PM.

Details

Summary

After extracting, fix up debug info in both the old and new functions by

  1. Pointing line locations and debug intrinsics to the new subprogram scope, and
  1. Deleting intrinsics which point to values outside of the new function.

Depends on https://reviews.llvm.org/D72795.

Testing: check-llvm, check-clang, a build of LNT in the -Os -g config
with "-mllvm -hot-cold-split=1" set, and end-to-end debugging of a toy
program which undergoes splitting to verify that lldb can find
variables, single step, etc. in extracted code.

rdar://45507940

Diff Detail

Event Timeline

vsk created this revision.Jan 15 2020, 12:50 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
aprantl added inline comments.Jan 15 2020, 1:13 PM
llvm/lib/Transforms/Utils/CodeExtractor.cpp
1388

///

1440

Out of curiosity: anything that can be shared with CloneFunction here?

1489

I'm not sure you actually need to call this when you don't create any new types with cycles.

llvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll
4

Can you add a comment what is being tested here?

llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll
4

and here

vsk updated this revision to Diff 238376.Jan 15 2020, 3:01 PM
vsk marked 6 inline comments as done.

Address review feedback.

llvm/lib/Transforms/Utils/CodeExtractor.cpp
1440

Unfortunately not. I actually looked into this before writing the patch, but most of what's needed here is specific to moving instructions from one function to another.

1489

Removed, thanks.

aprantl accepted this revision.Jan 15 2020, 3:34 PM

Looks plausible.

This revision is now accepted and ready to land.Jan 15 2020, 3:34 PM
This revision was automatically updated to reflect the committed changes.