[llvm] ee36206 - Revert "[InstCombine] Drop debug loc in TryToSinkInstruction"

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 14:59:48 PDT 2020


Author: Vedant Kumar
Date: 2020-06-26T14:59:40-07:00
New Revision: ee3620643dfc88a178fa4ca116cf83014e4ee547

URL: https://github.com/llvm/llvm-project/commit/ee3620643dfc88a178fa4ca116cf83014e4ee547
DIFF: https://github.com/llvm/llvm-project/commit/ee3620643dfc88a178fa4ca116cf83014e4ee547.diff

LOG: Revert "[InstCombine] Drop debug loc in TryToSinkInstruction"

This reverts commit 903cf140d0118cf0d3f0f6f8967c6a20d9c5be6b.

This might be causing verifier failures on the bots, such as: "inlinable
function call in a function with debug info must have a !dbg location"
--

http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/16976/steps/bootstrap%20clang/logs/stdio

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 
    llvm/test/Transforms/InstCombine/sink_to_unreachable_dbg.ll


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 3bdf05266a23..1f97f0c1ac99 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3355,10 +3355,6 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
   I->moveBefore(&*InsertPos);
   ++NumSunkInst;
 
-  // Drop the debug loc. This prevents single-stepping from going backwards.
-  // See HowToUpdateDebugInfo.rst for the full rationale.
-  I->setDebugLoc(DebugLoc());
-
   // Also sink all related debug uses from the source basic block. Otherwise we
   // get debug use before the def. Attempt to salvage debug uses first, to
   // maximise the range variables have location for. If we cannot salvage, then

diff  --git a/llvm/test/Transforms/InstCombine/sink_to_unreachable_dbg.ll b/llvm/test/Transforms/InstCombine/sink_to_unreachable_dbg.ll
deleted file mode 100644
index 2b7aa75d3bb6..000000000000
--- a/llvm/test/Transforms/InstCombine/sink_to_unreachable_dbg.ll
+++ /dev/null
@@ -1,42 +0,0 @@
-; RUN: opt -instcombine -S < %s | FileCheck %s
-
-; CHECK-LABEL: @test(
-; CHECK: [[phi:%.*]] = phi i32
-; CHECK-NEXT: [[add:%.*]] = add i32 %x, 1{{$}}
-; CHECK-NEXT: add i32 [[phi]], [[add]], !dbg
-define i32 @test(i32 %x, i1 %c) !dbg !6 {
-bb0:
-  %a = add i32 %x, 1, !dbg !8
-  br i1 %c, label %bb1, label %bb2, !dbg !9
-
-bb1:                                              ; preds = %bb0
-  br label %bb3, !dbg !10
-
-bb2:                                              ; preds = %bb0
-  br label %bb3, !dbg !11
-
-bb3:                                              ; preds = %bb2, %bb1
-  %p = phi i32 [ 0, %bb1 ], [ 1, %bb2 ], !dbg !12
-  %r = add i32 %p, %a, !dbg !13
-  ret i32 %r, !dbg !14
-}
-
-!llvm.dbg.cu = !{!0}
-!llvm.debugify = !{!3, !4}
-!llvm.module.flags = !{!5}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
-!1 = !DIFile(filename: "sink_to_unreachable_dbg.ll", directory: "/")
-!2 = !{}
-!3 = !{i32 7}
-!4 = !{i32 0}
-!5 = !{i32 2, !"Debug Info Version", i32 3}
-!6 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
-!7 = !DISubroutineType(types: !2)
-!8 = !DILocation(line: 1, column: 1, scope: !6)
-!9 = !DILocation(line: 2, column: 1, scope: !6)
-!10 = !DILocation(line: 3, column: 2, scope: !6)
-!11 = !DILocation(line: 4, column: 3, scope: !6)
-!12 = !DILocation(line: 5, column: 4, scope: !6)
-!13 = !DILocation(line: 6, column: 4, scope: !6)
-!14 = !DILocation(line: 7, column: 4, scope: !6)


        


More information about the llvm-commits mailing list