[llvm] r361246 - Revert r360902 "Resubmit: [Salvage] Change salvage debug info ..."

Bob Haarman via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 04:53:41 PDT 2019


Author: inglorion
Date: Tue May 21 04:53:41 2019
New Revision: 361246

URL: http://llvm.org/viewvc/llvm-project?rev=361246&view=rev
Log:
Revert r360902 "Resubmit: [Salvage] Change salvage debug info ..."

This reverts commit rr360902. It caused an assertion failure in
lib/IR/DebugInfoMetadata.cpp: Assertion `(OffsetInBits + SizeInBits <=
FragmentSizeInBits) && "new fragment outside of original fragment"'
failed.

PR41931.

Removed:
    llvm/trunk/test/DebugInfo/salvage-cast-debug-info.ll
Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp
    llvm/trunk/test/Transforms/EarlyCSE/debug-info-undef.ll
    llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll
    llvm/trunk/test/Transforms/InstCombine/unavailable-debug.ll

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=361246&r1=361245&r2=361246&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue May 21 04:53:41 2019
@@ -1690,27 +1690,8 @@ DIExpression *llvm::salvageDebugInfoImpl
     // No-op casts and zexts are irrelevant for debug info.
     if (CI->isNoopCast(DL) || isa<ZExtInst>(&I))
       return SrcDIExpr;
-
-    Type *Type = CI->getType();
-    // Casts other than Trunc or SExt to scalar types cannot be salvaged.
-    if (Type->isVectorTy() || (!isa<TruncInst>(&I) && !isa<SExtInst>(&I)))
-      return nullptr;
-
-    Value *FromValue = CI->getOperand(0);
-    unsigned FromTypeBitSize = FromValue->getType()->getScalarSizeInBits();
-
-    unsigned ToTypeBitSize = Type->getScalarSizeInBits();
-
-    // The result of the cast will be sign extended iff the instruction is a
-    // SExt; signedness is otherwise irrelevant on the expression stack.
-    unsigned Encoding =
-        isa<SExtInst>(&I) ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned;
-
-    return applyOps({dwarf::DW_OP_LLVM_convert, FromTypeBitSize, Encoding,
-                     dwarf::DW_OP_LLVM_convert, ToTypeBitSize, Encoding});
-  }
-
-  if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) {
+    return nullptr;
+  } else if (auto *GEP = dyn_cast<GetElementPtrInst>(&I)) {
     unsigned BitWidth =
         M.getDataLayout().getIndexSizeInBits(GEP->getPointerAddressSpace());
     // Rewrite a constant GEP into a DIExpression.

Removed: llvm/trunk/test/DebugInfo/salvage-cast-debug-info.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/salvage-cast-debug-info.ll?rev=361245&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/salvage-cast-debug-info.ll (original)
+++ llvm/trunk/test/DebugInfo/salvage-cast-debug-info.ll (removed)
@@ -1,25 +0,0 @@
-; RUN: opt %s -debugify -early-cse -S | FileCheck %s
-define i32 @foo(i64 %nose, i32 %more) {
-; CHECK-LABEL: @foo(
-; CHECK: call void @llvm.dbg.value(metadata i64 %nose, metadata [[V1:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned
-; CHECK: call void @llvm.dbg.value(metadata i64 %nose.shift, metadata [[V2:![0-9]+]]
-; CHECK: call void @llvm.dbg.value(metadata i64 %nose.shift, metadata [[V3:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned
-
-entry:
-  %nose.trunc = trunc i64 %nose to i32
-  %nose.shift = lshr i64 %nose, 32
-  %nose.trunc.2 = trunc i64 %nose.shift to i32
-  %add = add nsw i32 %more, 1
-  ret i32 %add
-}
-
-!llvm.module.flags = !{!0, !1}
-!llvm.ident = !{!2}
-
-!0 = !{i32 1, !"wchar_size", i32 2}
-!1 = !{i32 7, !"PIC Level", i32 2}
-!2 = !{!"clang version 9.0.0 "}
-
-; CHECK: [[V1]] = !DILocalVariable(
-; CHECK: [[V2]] = !DILocalVariable(
-; CHECK: [[V3]] = !DILocalVariable(

Modified: llvm/trunk/test/Transforms/EarlyCSE/debug-info-undef.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/EarlyCSE/debug-info-undef.ll?rev=361246&r1=361245&r2=361246&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/EarlyCSE/debug-info-undef.ll (original)
+++ llvm/trunk/test/Transforms/EarlyCSE/debug-info-undef.ll Tue May 21 04:53:41 2019
@@ -10,7 +10,7 @@ entry:
   %0 = load i8, i8* @a, align 1, !dbg !19, !tbaa !20
   %conv = sext i8 %0 to i16, !dbg !19
 
-; CHECK: call void @llvm.dbg.value(metadata i8 %0, metadata !17, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 16, DW_ATE_signed, DW_OP_stack_value)), !dbg !18
+; CHECK: call void @llvm.dbg.value(metadata i16 undef, metadata !17, metadata !DIExpression()), !dbg !18
 ; CHECK-NEXT:  call i32 (...) @optimize_me_not()
 
   call void @llvm.dbg.value(metadata i16 %conv, metadata !17, metadata !DIExpression()), !dbg !18

Modified: llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll?rev=361246&r1=361245&r2=361246&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll Tue May 21 04:53:41 2019
@@ -13,8 +13,6 @@ define i32 @mul(i32 %x, i32 %y) {
 ; we preserve the debug information in the resulting
 ; instruction.
 ; DBGINFO-LABEL: @mul(
-; DBGINFO-NEXT:    call void @llvm.dbg.value(metadata i32 %x
-; DBGINFO-NEXT:    call void @llvm.dbg.value(metadata i32 %y
 ; DBGINFO-NEXT:    [[C:%.*]] = mul i32 {{.*}}
 ; DBGINFO-NEXT:    [[D:%.*]] = and i32 {{.*}}
 ; DBGINFO-NEXT:    call void @llvm.dbg.value(metadata i32 [[C]]

Modified: llvm/trunk/test/Transforms/InstCombine/unavailable-debug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/unavailable-debug.ll?rev=361246&r1=361245&r2=361246&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/unavailable-debug.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/unavailable-debug.ll Tue May 21 04:53:41 2019
@@ -2,7 +2,7 @@
 
 ; Make sure to update the debug value after dead code elimination.
 ; CHECK: %call = call signext i8 @b(i32 6), !dbg !39
-; CHECK-NEXT: call void @llvm.dbg.value(metadata i8 %call, metadata !30, metadata !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)), !dbg !38
+; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata !30, metadata !DIExpression()), !dbg !38
 
 @e = common local_unnamed_addr global i8 0, align 1, !dbg !0
 @c = common local_unnamed_addr global i32 0, align 4, !dbg !6




More information about the llvm-commits mailing list