From: Stephen Tozer Date: Wed, 15 May 2019 13:41:44 +0000 (+0000) Subject: Revert "[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dabe45c6d5c291c80e82ecb5466910357d04f7ce;p=llvm Revert "[Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert where needed" This reverts r360772 due to build issues. Reverted commit: 17dd4d7403770bd683675e45f5517e0cdb8f9b2b. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360773 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 04e6cbb20c3..2a4e9054273 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -1690,27 +1690,8 @@ DIExpression *llvm::salvageDebugInfoImpl(Instruction &I, // No-op casts and zexts are irrelevant for debug info. if (CI->isNoopCast(DL) || isa(&I)) return SrcDIExpr; - - Type *Type = CI->getType(); - // Casts other than Trunc or SExt to scalar types cannot be salvaged. - if (Type->isVectorTy() || (!isa(&I) && !isa(&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(&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(&I)) { + return nullptr; + } else if (auto *GEP = dyn_cast(&I)) { unsigned BitWidth = M.getDataLayout().getIndexSizeInBits(GEP->getPointerAddressSpace()); // Rewrite a constant GEP into a DIExpression. diff --git a/test/DebugInfo/salvage-cast-debug-info.ll b/test/DebugInfo/salvage-cast-debug-info.ll deleted file mode 100755 index 1c8196a6589..00000000000 --- a/test/DebugInfo/salvage-cast-debug-info.ll +++ /dev/null @@ -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( diff --git a/test/Transforms/InstCombine/cast-mul-select.ll b/test/Transforms/InstCombine/cast-mul-select.ll index f82d2fd285f..c501fd8d04c 100644 --- a/test/Transforms/InstCombine/cast-mul-select.ll +++ b/test/Transforms/InstCombine/cast-mul-select.ll @@ -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]]