Building the given test case with 'clang -O2 -g' the call to
getInOrder is sunk out of the loop by LICM, but the source
location is not dropped.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Scalar/LICM.cpp | ||
---|---|---|
1715 | Can you add a comment here explaining that we do this because we sink the instruction out of the BB? |
I think we can greatly simplify the test to make it easier for readers to understand what's going on. I left some inline comments, and the test itself could start along these lines:
; CHECK-LABEL: for.end: ; CHECK: tail call noundef i32 @foo0({{.*}}), !dbg ![[DBG:[0-9]+]] ; CHECK-DAG: ![[DBG]] = !DILocation(line: 0, scope: ![[SCOPE:[0-9]+]] ; CHECK-DAG: ![[SCOPE]] = distinct !DISubprogram(name: "bounce", define noundef i32 @foo0(i32 noundef %Idx) #0 !dbg !9 { ret i32 2, !dbg !14 } define noundef i32 @foo1(i32 noundef %Idx) #0 !dbg !15 { ret i32 4, !dbg !16 } define i32 @foo2() !dbg !17 { entry: br label %for.body, !dbg !20 ... rest of the test here ...
llvm/test/Transforms/LICM/sink-instruction-invalid-location.ll | ||
---|---|---|
31 | We shouldn't hardcode the name of SSA values, these are not guaranteed to be preserved by opt. I believe the same apply for the names of BBs (which are also SSA values) | |
36 | I believe this variable is not used anywhere? | |
40 | If I understand correctly, the contents of this function are not needed by the test and could be replaced by a ret i32 2 Note this will also make the other GV unused. |
Can you add a comment here explaining that we do this because we sink the instruction out of the BB?