[PATCH] D78749: [CodeExtractor] Fix extraction of a value used only by intrinsics outside of region

Ehud Katz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 01:02:14 PDT 2020


ekatz marked 4 inline comments as done.
ekatz added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/CodeExtractor.cpp:467
       }
-      continue;
+      if (isa<DbgInfoIntrinsic>(IntrInst))
+        continue;
----------------
vsk wrote:
> Could you add a comment: // At this point, permit debug uses outside of the region, this is fixed in \ref fixupDebugInfoPostExtraction.
Sure! But as `\ref` is a doxygen token (and this is not a doxygen comment), I offer the following:
```
// At this point, permit debug uses outside of the region.
// This is fixed in a later call to fixupDebugInfoPostExtraction().
```


================
Comment at: llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll:2
+; RUN: opt -loop-extract -S < %s | FileCheck %s
+
+; This tests 2 cases:
----------------
vsk wrote:
> It looks like -loop-extract behaves like a ModulePass. If that's right, this test should pass if you add a RUN line like: `RUN: opt -debugify-each -loop-extract ... | FileCheck %s`.
> 
> This would just add synthetic debug uses before -loop-extract and strip them away afterwards, the final IR should look identical (if there are no bugs w.r.t handling debug uses).
Great suggestion!
Though, `-debugify-each` results with:
```
ERROR: Instruction with empty DebugLoc in function test --  %lt.cast = bitcast i32* %v1 to i8*
ERROR: Instruction with empty DebugLoc in function test --  call void @llvm.lifetime.start.p0i8(i64 -1, i8* %lt.cast)
ERROR: Instruction with empty DebugLoc in function test --  br label %loop1.loop2_crit_edge
ERROR: Instruction with empty DebugLoc in function test --  br label %exit
ERROR: Instruction with empty DebugLoc in function test.loop2 --  ret void
ERROR: Instruction with empty DebugLoc in function test.loop1 --  ret void
WARNING: Missing line 9
WARNING: Missing variable 2
WARNING: Missing variable 4
CheckModuleDebugify [Extract loops into new functions]: FAIL
CheckFunctionDebugify [Module Verifier]: PASS
CheckFunctionDebugify [Module Verifier]: PASS
CheckFunctionDebugify [Module Verifier]: PASS
```
This is probably a different bug that needs to be solved.

So, instead I'll just use `-debugify` and update the expected result to include the debug info.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78749/new/

https://reviews.llvm.org/D78749





More information about the llvm-commits mailing list