<div dir="ltr">Awesome - thanks a bunch for this cleanup/improvement/fix. (I know I was to blame for some of the "indirect" flag stuff you're cleaning up here, before we had DIExpression, etc)</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 18, 2015 at 6:02 PM, Keno Fischer via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: kfischer<br>
Date: Fri Dec 18 20:02:44 2015<br>
New Revision: 256077<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256077&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=256077&view=rev</a><br>
Log:<br>
Clean up the processing of dbg.value in various places<br>
<br>
Summary:<br>
First up is instcombine, where in the dbg.declare -> dbg.value conversion,<br>
the llvm.dbg.value needs to be called on the actual loaded value, rather<br>
than the address (since the whole point of this transformation is to be<br>
able to get rid of the alloca). Further, now that that's cleaned up, we<br>
can remove a hack in the backend, that would add an implicit OP_deref if<br>
the argument to dbg.value was an alloca. This stems from before the<br>
existence of DIExpression and is no longer necessary since the deref can<br>
be expressed explicitly.<br>
<br>
Now, in order to make sure that the tests pass with this change, we need to<br>
correct the printing of DEBUG_VALUE comments to take into account the<br>
expression, which wasn't taken into account before.<br>
<br>
Unfortunately, for both these changes, there were a number of incorrect<br>
test cases (mostly the wrong number of DW_OP_derefs, but also a couple<br>
where the test itself was broken more badly). aprantl and I have gone<br>
through and adjusted these test case in order to make them pass with<br>
these fixes and in some cases to make sure they're actually testing<br>
what they are meant to test.<br>
<br>
Reviewers: aprantl<br>
<br>
Subscribers: dsanders<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D14186" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14186</a><br>
<br>
Added:<br>
llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll<br>
Modified:<br>
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
llvm/trunk/lib/Transforms/Utils/Local.cpp<br>
llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll<br>
llvm/trunk/test/DebugInfo/AArch64/coalescing.ll<br>
llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll<br>
llvm/trunk/test/DebugInfo/X86/array.ll<br>
llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll<br>
llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll<br>
llvm/trunk/test/DebugInfo/X86/op_deref.ll<br>
llvm/trunk/test/DebugInfo/X86/reference-argument.ll<br>
llvm/trunk/test/DebugInfo/X86/vla.ll<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Dec 18 20:02:44 2015<br>
@@ -775,6 +775,28 @@ static bool emitDebugValueComment(const<br>
bool Deref = MI->getOperand(0).isReg() && MI->getOperand(1).isImm();<br>
int64_t Offset = Deref ? MI->getOperand(1).getImm() : 0;<br>
<br>
+ for (unsigned i = 0; i < Expr->getNumElements(); ++i) {<br>
+ if (Deref) {<br>
+ // We currently don't support extra Offsets or derefs after the first<br>
+ // one. Bail out early instead of emitting an incorrect comment<br>
+ OS << " [complex expression]";<br>
+ AP.OutStreamer->emitRawComment(OS.str());<br>
+ return true;<br>
+ }<br>
+ uint64_t Op = Expr->getElement(i);<br>
+ if (Op == dwarf::DW_OP_deref) {<br>
+ Deref = true;<br>
+ continue;<br>
+ }<br>
+ uint64_t ExtraOffset = Expr->getElement(i++);<br>
+ if (Op == dwarf::DW_OP_plus)<br>
+ Offset += ExtraOffset;<br>
+ else {<br>
+ assert(Op == dwarf::DW_OP_minus);<br>
+ Offset -= ExtraOffset;<br>
+ }<br>
+ }<br>
+<br>
// Register or immediate value. Register 0 means undef.<br>
if (MI->getOperand(0).isFPImm()) {<br>
APFloat APF = APFloat(MI->getOperand(0).getFPImm()->getValueAPF());<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 18 20:02:44 2015<br>
@@ -950,14 +950,12 @@ void SelectionDAGBuilder::resolveDanglin<br>
assert(Variable->isValidLocationForIntrinsic(dl) &&<br>
"Expected inlined-at fields to agree");<br>
uint64_t Offset = DI->getOffset();<br>
- // A dbg.value for an alloca is always indirect.<br>
- bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;<br>
SDDbgValue *SDV;<br>
if (Val.getNode()) {<br>
- if (!EmitFuncArgumentDbgValue(V, Variable, Expr, dl, Offset, IsIndirect,<br>
+ if (!EmitFuncArgumentDbgValue(V, Variable, Expr, dl, Offset, false,<br>
Val)) {<br>
SDV = DAG.getDbgValue(Variable, Expr, Val.getNode(), Val.getResNo(),<br>
- IsIndirect, Offset, dl, DbgSDNodeOrder);<br>
+ false, Offset, dl, DbgSDNodeOrder);<br>
DAG.AddDbgValue(SDV, Val.getNode(), false);<br>
}<br>
} else<br>
@@ -4515,12 +4513,10 @@ SelectionDAGBuilder::visitIntrinsicCall(<br>
// Check unused arguments map.<br>
N = UnusedArgNodeMap[V];<br>
if (N.getNode()) {<br>
- // A dbg.value for an alloca is always indirect.<br>
- bool IsIndirect = isa<AllocaInst>(V) || Offset != 0;<br>
if (!EmitFuncArgumentDbgValue(V, Variable, Expression, dl, Offset,<br>
- IsIndirect, N)) {<br>
+ false, N)) {<br>
SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),<br>
- IsIndirect, Offset, dl, SDNodeOrder);<br>
+ false, Offset, dl, SDNodeOrder);<br>
DAG.AddDbgValue(SDV, N.getNode(), false);<br>
}<br>
} else if (!V->use_empty() ) {<br>
<br>
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Dec 18 20:02:44 2015<br>
@@ -1071,8 +1071,13 @@ bool llvm::ConvertDebugDeclareToDebugVal<br>
if (LdStHasDebugValue(DIVar, LI))<br>
return true;<br>
<br>
- Builder.insertDbgValueIntrinsic(LI->getOperand(0), 0, DIVar, DIExpr,<br>
- DDI->getDebugLoc(), LI);<br>
+ // We are now tracking the loaded value instead of the address. In the<br>
+ // future if multi-location support is added to the IR, it might be<br>
+ // preferable to keep tracking both the loaded value and the original<br>
+ // address in case the alloca can not be elided.<br>
+ Instruction *DbgValue = Builder.insertDbgValueIntrinsic(<br>
+ LI, 0, DIVar, DIExpr, DDI->getDebugLoc(), (Instruction *)nullptr);<br>
+ DbgValue->insertAfter(LI);<br>
return true;<br>
}<br>
<br>
@@ -1114,9 +1119,13 @@ bool llvm::LowerDbgDeclare(Function &F)<br>
// This is a call by-value or some other instruction that<br>
// takes a pointer to the variable. Insert a *value*<br>
// intrinsic that describes the alloca.<br>
+ SmallVector<uint64_t, 1> NewDIExpr;<br>
+ auto *DIExpr = DDI->getExpression();<br>
+ NewDIExpr.push_back(dwarf::DW_OP_deref);<br>
+ NewDIExpr.append(DIExpr->elements_begin(), DIExpr->elements_end());<br>
DIB.insertDbgValueIntrinsic(AI, 0, DDI->getVariable(),<br>
- DDI->getExpression(), DDI->getDebugLoc(),<br>
- CI);<br>
+ DIB.createExpression(NewDIExpr),<br>
+ DDI->getDebugLoc(), CI);<br>
}<br>
DDI->eraseFromParent();<br>
}<br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/debug-info-blocks.ll Fri Dec 18 20:02:44 2015<br>
@@ -1,5 +1,21 @@<br>
-; RUN: llc -O0 < %s | FileCheck %s<br>
-; CHECK: @DEBUG_VALUE: foobar_func_block_invoke_0:mydata <- [%SP+{{[0-9]+}}]<br>
+; RUN: %llc_dwarf -filetype=obj -O0 < %s | llvm-dwarfdump - | FileCheck %s<br>
+<br>
+; debug_info content<br>
+; CHECK: DW_AT_name {{.*}} "foobar_func_block_invoke_0"<br>
+; CHECK-NOT: DW_TAG_subprogram<br>
+; CHECK: DW_TAG_variable<br>
+; CHECK-NOT: DW_TAG<br>
+; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[MYDATA_LOC:0x[0-9a-f]*]])<br>
+; CHECK-NEXT: DW_AT_name {{.*}} "mydata"<br>
+<br>
+; debug_loc content<br>
+; CHECK: .debug_loc contents:<br>
+; CHECK: [[MYDATA_LOC]]: Beginning address offset: {{.*}}<br>
+; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset<br>
+; CHECK: Location description: {{.*}} 23 04 06 23 18<br>
+; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset<br>
+; CHECK: Location description: {{.*}} 23 04 06 23 18<br>
+<br>
; Radar 9331779<br>
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"<br>
target triple = "thumbv7-apple-ios"<br>
<br>
Modified: llvm/trunk/test/DebugInfo/AArch64/coalescing.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/coalescing.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/coalescing.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/AArch64/coalescing.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/AArch64/coalescing.ll Fri Dec 18 20:02:44 2015<br>
@@ -60,6 +60,6 @@ attributes #3 = { nounwind optsize }<br>
!13 = !{i32 2, !"Debug Info Version", i32 3}<br>
!14 = !{!"clang version 3.6.0 (trunk 223149) (llvm/trunk 223115)"}<br>
!15 = !DILocation(line: 5, column: 3, scope: !4)<br>
-!16 = !DIExpression()<br>
+!16 = !DIExpression(DW_OP_deref)<br>
!17 = !DILocation(line: 4, column: 12, scope: !4)<br>
!18 = !DILocation(line: 8, column: 1, scope: !4)<br>
<br>
Modified: llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/Mips/dsr-fixed-objects.ll Fri Dec 18 20:02:44 2015<br>
@@ -33,18 +33,18 @@ declare void @foo(i32*)<br>
define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 {<br>
entry:<br>
%x = alloca i32, align 4<br>
- tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !9, metadata !26), !dbg !27<br>
- tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !10, metadata !26), !dbg !28<br>
- tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !11, metadata !26), !dbg !29<br>
- tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !12, metadata !26), !dbg !30<br>
- tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !13, metadata !26), !dbg !31<br>
+ tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !9, metadata !DIExpression()), !dbg !27<br>
+ tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !10, metadata !DIExpression()), !dbg !28<br>
+ tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !11, metadata !DIExpression()), !dbg !29<br>
+ tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !12, metadata !DIExpression()), !dbg !30<br>
+ tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !13, metadata !DIExpression()), !dbg !31<br>
%0 = bitcast i32* %x to i8*, !dbg !32<br>
call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !32<br>
%add = add nsw i32 %b, %a, !dbg !33<br>
%add1 = add nsw i32 %add, %c, !dbg !34<br>
%add2 = add nsw i32 %add1, %d, !dbg !35<br>
%add3 = add nsw i32 %add2, %e, !dbg !36<br>
- tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !14, metadata !26), !dbg !37<br>
+ tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !14, metadata !DIExpression()), !dbg !37<br>
store i32 %add3, i32* %x, align 4, !dbg !37, !tbaa !38<br>
tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !26), !dbg !37<br>
call void @foo(i32* nonnull %x) #4, !dbg !42<br>
@@ -66,18 +66,18 @@ entry:<br>
define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 {<br>
entry:<br>
%x = alloca i32, align 16<br>
- tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !17, metadata !26), !dbg !46<br>
- tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !18, metadata !26), !dbg !47<br>
- tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !19, metadata !26), !dbg !48<br>
- tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !20, metadata !26), !dbg !49<br>
- tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !21, metadata !26), !dbg !50<br>
+ tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !17, metadata !DIExpression()), !dbg !46<br>
+ tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !18, metadata !DIExpression()), !dbg !47<br>
+ tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !19, metadata !DIExpression()), !dbg !48<br>
+ tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !20, metadata !DIExpression()), !dbg !49<br>
+ tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !21, metadata !DIExpression()), !dbg !50<br>
%0 = bitcast i32* %x to i8*, !dbg !51<br>
call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !51<br>
%add = add nsw i32 %b, %a, !dbg !52<br>
%add1 = add nsw i32 %add, %c, !dbg !53<br>
%add2 = add nsw i32 %add1, %d, !dbg !54<br>
%add3 = add nsw i32 %add2, %e, !dbg !55<br>
- tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !22, metadata !26), !dbg !56<br>
+ tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !22, metadata !DIExpression()), !dbg !56<br>
store i32 %add3, i32* %x, align 16, !dbg !56, !tbaa !38<br>
tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !22, metadata !26), !dbg !56<br>
call void @foo(i32* nonnull %x) #4, !dbg !57<br>
@@ -119,7 +119,7 @@ declare void @llvm.dbg.value(metadata, i<br>
!23 = !{i32 2, !"Dwarf Version", i32 4}<br>
!24 = !{i32 2, !"Debug Info Version", i32 3}<br>
!25 = !{!"clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)"}<br>
-!26 = !DIExpression()<br>
+!26 = !DIExpression(DW_OP_deref)<br>
!27 = !DILocation(line: 4, column: 12, scope: !4)<br>
!28 = !DILocation(line: 4, column: 19, scope: !4)<br>
!29 = !DILocation(line: 4, column: 26, scope: !4)<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/array.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/array.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/array.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/array.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/array.ll Fri Dec 18 20:02:44 2015<br>
@@ -37,13 +37,13 @@ define i32 @main(i32 %argc, i8** nocaptu<br>
%array = alloca [4 x i32], align 16<br>
tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !19, metadata !DIExpression()), !dbg !35<br>
tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !20, metadata !DIExpression()), !dbg !35<br>
- tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression()), !dbg !36<br>
+ tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !36<br>
%1 = bitcast [4 x i32]* %array to i8*, !dbg !36<br>
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i32 16, i1 false), !dbg !36<br>
- tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression()), !dbg !36<br>
+ tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !36<br>
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %array, i64 0, i64 0, !dbg !37<br>
call void @f(i32* %2), !dbg !37<br>
- tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression()), !dbg !36<br>
+ tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression(DW_OP_deref)), !dbg !36<br>
%3 = load i32, i32* %2, align 16, !dbg !38, !tbaa !30<br>
ret i32 %3, !dbg !38<br>
}<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-const-byref.ll Fri Dec 18 20:02:44 2015<br>
@@ -56,7 +56,7 @@ entry:<br>
%call1 = call i32 (...) @f1() #3, !dbg !19<br>
call void @llvm.dbg.value(metadata i32 %call1, i64 0, metadata !10, metadata !DIExpression()), !dbg !19<br>
store i32 %call1, i32* %i, align 4, !dbg !19, !tbaa !20<br>
- call void @llvm.dbg.value(metadata i32* %i, i64 0, metadata !10, metadata !DIExpression()), !dbg !24<br>
+ call void @llvm.dbg.value(metadata i32* %i, i64 0, metadata !10, metadata !DIExpression(DW_OP_deref)), !dbg !24<br>
call void @f2(i32* %i) #3, !dbg !24<br>
ret i32 0, !dbg !25<br>
}<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll Fri Dec 18 20:02:44 2015<br>
@@ -7,15 +7,14 @@<br>
; int bar(int y) {<br>
; return y + 2;<br>
; }<br>
-; with "clang++ -S -emit-llvm -fsanitize=address -O0 -g test.cc"<br>
+; with "clang++ -S -emit-llvm -mllvm -asan-skip-promotable-allocas=0 -fsanitize=address -O0 -g test.cc"<br>
<br>
-; First, argument variable "y" resides in %rdi:<br>
-; CHECK: DEBUG_VALUE: bar:y <- %RDI<br>
-<br>
-; Then its address is stored in a location on a stack:<br>
+; The address of the (potentially now malloc'ed) alloca ends up<br>
+; in RDI, after which it is spilled to the stack. We record the<br>
+; spill OFFSET on the stack for checking the debug info below.<br>
+; CHECK: #DEBUG_VALUE: bar:y <- [%RDI+0]<br>
; CHECK: movq %rdi, [[OFFSET:[0-9]+]](%rsp)<br>
; CHECK-NEXT: [[START_LABEL:.Ltmp[0-9]+]]<br>
-; CHECK-NEXT: DEBUG_VALUE: bar:y <- [%RSP+[[OFFSET]]]<br>
; This location should be valid until the end of the function.<br>
<br>
; CHECK: .Ldebug_loc{{[0-9]+}}:<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/op_deref.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/op_deref.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/op_deref.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/op_deref.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/op_deref.ll Fri Dec 18 20:02:44 2015<br>
@@ -20,11 +20,11 @@<br>
; right now, so we check the asm output:<br>
; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK<br>
; vla should have a register-indirect address at one point.<br>
-; ASM-CHECK: DEBUG_VALUE: vla <- %RCX<br>
+; ASM-CHECK: DEBUG_VALUE: vla <- [%RCX+0]<br>
; ASM-CHECK: DW_OP_breg2<br>
<br>
; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s --check-prefix=PRETTY-PRINT<br>
-; PRETTY-PRINT: DIExpression(DW_OP_deref, DW_OP_deref)<br>
+; PRETTY-PRINT: DIExpression(DW_OP_deref)<br>
<br>
define void @testVLAwithSize(i32 %s) nounwind uwtable ssp !dbg !5 {<br>
entry:<br>
@@ -108,4 +108,4 @@ declare void @llvm.stackrestore(i8*) nou<br>
!27 = !DILocation(line: 8, column: 1, scope: !13)<br>
!28 = !DIFile(filename: "bar.c", directory: "/Users/echristo/tmp")<br>
!29 = !{i32 1, !"Debug Info Version", i32 3}<br>
-!30 = !DIExpression(DW_OP_deref, DW_OP_deref)<br>
+!30 = !DIExpression(DW_OP_deref)<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/reference-argument.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/reference-argument.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/reference-argument.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/reference-argument.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/reference-argument.ll Fri Dec 18 20:02:44 2015<br>
@@ -22,6 +22,7 @@ target triple = "x86_64-apple-macosx10.9<br>
<br>
declare void @_Z3barR4SVal(%class.SVal* %v)<br>
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br>
+declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1<br>
declare i32 @main()<br>
; Function Attrs: nounwind ssp uwtable<br>
define linkonce_odr void @_ZN1A3fooE4SVal(%class.A* %this, %class.SVal* %v) nounwind ssp uwtable align 2 !dbg !35 {<br>
@@ -29,7 +30,7 @@ entry:<br>
%this.addr = alloca %class.A*, align 8<br>
store %class.A* %this, %class.A** %this.addr, align 8<br>
call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !59, metadata !DIExpression()), !dbg !61<br>
- call void @llvm.dbg.declare(metadata %class.SVal* %v, metadata !62, metadata !DIExpression(DW_OP_deref)), !dbg !61<br>
+ call void @llvm.dbg.value(metadata %class.SVal* %v, i64 0, metadata !62, metadata !DIExpression(DW_OP_deref)), !dbg !61<br>
%this1 = load %class.A*, %class.A** %this.addr<br>
call void @_Z3barR4SVal(%class.SVal* %v), !dbg !61<br>
ret void, !dbg !61<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/vla.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/vla.ll?rev=256077&r1=256076&r2=256077&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/vla.ll?rev=256077&r1=256076&r2=256077&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/vla.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/vla.ll Fri Dec 18 20:02:44 2015<br>
@@ -1,6 +1,6 @@<br>
; RUN: llc -O0 -mtriple=x86_64-apple-darwin -filetype=asm %s -o - | FileCheck %s<br>
; Ensure that we generate an indirect location for the variable length array a.<br>
-; CHECK: ##DEBUG_VALUE: vla:a <- %RDX<br>
+; CHECK: ##DEBUG_VALUE: vla:a <- [%RDX+0]<br>
; CHECK: DW_OP_breg1<br>
; rdar://problem/13658587<br>
;<br>
<br>
Added: llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll?rev=256077&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll?rev=256077&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll (added)<br>
+++ llvm/trunk/test/Transforms/Util/simplify-dbg-declare-load.ll Fri Dec 18 20:02:44 2015<br>
@@ -0,0 +1,52 @@<br>
+; RUN: opt -instcombine -S < %s | FileCheck %s<br>
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
+target triple = "x86_64-pc-linux-gnu"<br>
+<br>
+%foo = type { i64, i32, i32 }<br>
+<br>
+; Function Attrs: nounwind readnone<br>
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #0<br>
+declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0<br>
+<br>
+; Function Attrs: sspreq<br>
+define void @julia_fastshortest_6256() #1 {<br>
+top:<br>
+ %cp = alloca %foo, align 8<br>
+ call void @llvm.dbg.declare(metadata %foo* %cp, metadata !1, metadata !16), !dbg !17<br>
+ br i1 undef, label %idxend, label %fail<br>
+<br>
+fail: ; preds = %top<br>
+ unreachable<br>
+<br>
+idxend: ; preds = %top<br>
+; CHECK-NOT call void @llvm.dbg.value(metadata %foo* %cp, i64 0, metadata !1, metadata !16), !dbg !17<br>
+ %0 = load volatile %foo, %foo* %cp, align 8<br>
+; CHECK: call void @llvm.dbg.value(metadata %foo %0, i64 0, metadata !1, metadata !16), !dbg !17<br>
+ store volatile %foo %0, %foo* undef, align 8<br>
+ ret void<br>
+}<br>
+<br>
+attributes #0 = { nounwind readnone }<br>
+attributes #1 = { sspreq }<br>
+<br>
+!llvm.module.flags = !{!0}<br>
+!<a href="http://llvm.dbg.cu" rel="noreferrer" target="_blank">llvm.dbg.cu</a> = !{}<br>
+<br>
+!0 = !{i32 1, !"Debug Info Version", i32 3}<br>
+!1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12)<br>
+!2 = distinct !DISubprogram(name: "fastshortest", linkageName: "julia_fastshortest_6256", scope: null, file: !3, type: !4, isLocal: false, isDefinition: true, isOptimized: true, variables: !11)<br>
+!3 = !DIFile(filename: "grisu/fastshortest.jl", directory: ".")<br>
+!4 = !DISubroutineType(types: !5)<br>
+!5 = !{!6, !7}<br>
+!6 = !DIBasicType(name: "Float64", size: 64, align: 64, encoding: DW_ATE_unsigned)<br>
+!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 64)<br>
+!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !9, line: 71, align: 64, elements: !10)<br>
+!9 = !DIFile(filename: "julia.h", directory: "")<br>
+!10 = !{!7}<br>
+!11 = !{}<br>
+!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "Float", size: 128, align: 64, elements: !13, runtimeLang: DW_LANG_Julia)<br>
+!13 = !{!14, !15, !15}<br>
+!14 = !DIBasicType(name: "UInt64", size: 64, align: 64, encoding: DW_ATE_unsigned)<br>
+!15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned)<br>
+!16 = !DIExpression()<br>
+!17 = !DILocation(line: 106, scope: !2)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>