[llvm] [CodeExtractor] Improve debug info for input values. (PR #136016)

Tim Gymnich via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 10:55:30 PDT 2025


================
@@ -1242,11 +1242,18 @@ static void eraseDebugIntrinsicsWithNonLocalRefs(Function &F) {
   }
 }
 
-/// Fix up the debug info in the old and new functions by pointing line
-/// locations and debug intrinsics to the new subprogram scope, and by deleting
-/// intrinsics which point to values outside of the new function.
-static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
-                                         CallInst &TheCall) {
+/// Fix up the debug info in the old and new functions. Following changes are
+/// done.
+/// 1. If a debug record points to a value that has been replaced, update the
+/// record to use the new value.
+/// 2. If an Input value that has been replaced was used as a location of a
+/// debug record in the Parent function, then materealize a similar record in
+/// the new function.
+/// 3. Point line locations and debug intrinsics to the new subprogram scope
+/// 4. Remove intrinsics which point to values outside of the new function.
+static void fixupDebugInfoPostExtraction(
+    Function &OldFunc, Function &NewFunc, CallInst &TheCall,
+    const SetVector<Value *> &Inputs, const SmallVector<Value *> &NewValues) {
----------------
tgymnich wrote:

```suggestion
    const SetVector<Value *> &Inputs, ArrayRef<Value *> NewValues) {
```

https://github.com/llvm/llvm-project/pull/136016


More information about the llvm-commits mailing list