[PATCH] D139217: [CodeExtractor] Correctly propagate scope information post extraction

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 11:44:41 PST 2022


fdeazeve created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When a new function "NewF" is created to receive instructions from
another function "OldF", the CodeExtractor preserves debug line/column
of the extracted instructions. However:

1. Any inlinedAt information is dropped.
2. The scope chain is replaced with a single node, the Subprogram of NewF.

Both of these are incorrect, the original information should be
preserved, with the exception of the Subprogram corresponding to OldF,
which should now be the Subprogram NewF.

We accomplish this by finding the last node in the inline chain of the
DebugLoc, and recreating its scope chain so that it ends in the
Subprogram of NewF. The inline chain is then recreated to account for
these changes in the scope of the last node.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139217

Files:
  llvm/include/llvm/IR/DebugLoc.h
  llvm/lib/IR/DebugLoc.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/test/Transforms/HotColdSplit/transfer-debug-info.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139217.479699.patch
Type: text/x-patch
Size: 8009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/0278d018/attachment.bin>


More information about the llvm-commits mailing list