[PATCH] D70597: [PHIEliminate] skip dbg instruction when LowerPHINode

Chris Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 18:43:52 PST 2020


yechunliang added a comment.

Checked with extracted.ll, on the block [19]:  the dbg.value did not skip "llvm.lifetime" and "%21 add" move after Label by SkipPHIsAndLabels() while ScheduleDAGSDNodes.
And later PASS (after ScheduleDAGSDNodes) removed "call llvm.lifetime.start" and "%21 add", and then left DBG_VALUEs between PHI and LABELs, and make errors.

original IR:

  19:                                               ; preds = %27, %4
    %20 = phi i32 [ 0, %4 ], [ %21, %27 ], !dbg !15321
    call void @llvm.dbg.value(metadata i32 %20, metadata !15278, metadata !DIExpression()), !dbg !15321
    call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %11) #6, !dbg !15520
    %21 = add nuw nsw i32 %20, 1, !dbg !15521
    call void @llvm.dbg.value(metadata i32 %21, metadata !15278, metadata !DIExpression()), !dbg !15321
    invoke void @_ZN7testing8internal8FilePath12MakeFileNameERKS1_S3_iPKc(%"class.testing::internal::FilePath"* nonnull sret %6, %"class.testing::internal::FilePath"* nonnull dereferenceable(32) %1,    %"class.testing::internal::FilePath"* nonnull dereferenceable(32) %2, i32 %20, i8* %3)
            to label %22 unwind label %31, !dbg !15520

After  "X86 DAG->DAG Instruction Selection":

  %2:gr32 = PHI %17:gr32, %bb.0, debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0
    LIFETIME_START %stack.1, debug-location !15502; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:23
    %3:gr32 = nuw nsw ADD32ri8 %2:gr32(tied-def 0), 1, implicit-def dead $eflags, debug-location !15503; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:64
    DBG_VALUE %3:gr32, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
    EH_LABEL <mcsymbol .Ltmp0>, debug-location !15502; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:23

After Merge disjoint stack slots

  %2:gr32 = PHI %17:gr32, %bb.0, %3:gr32, %bb.5, debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0
    DBG_VALUE %2:gr32, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
    %3:gr32 = nuw nsw ADD32ri8 %2:gr32(tied-def 0), 1, implicit-def dead $eflags, debug-location !15503; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:64
    DBG_VALUE %3:gr32, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
    EH_LABEL <mcsymbol .Ltmp0>, debug-location !15502; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:23

After Machine code sinking

  %2:gr32 = PHI %17:gr32, %bb.0, %3:gr32, %bb.5, debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0
    DBG_VALUE %2:gr32, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
    DBG_VALUE $noreg, $noreg, !"number", !DIExpression(), debug-location !15321; llvm/utils/unittest/googletest/src/gtest-filepath.cc:0 line no:290
    EH_LABEL <mcsymbol .Ltmp0>, debug-location !15502; llvm/utils/unittest/googletest/src/gtest-filepath.cc:292:23


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70597





More information about the llvm-commits mailing list