From: Alexey Lapshin Date: Wed, 4 Sep 2019 14:19:49 +0000 (+0000) Subject: [Debuginfo][SROA] Need to handle dbg.value in SROA pass. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4cdb2b38d8574e3c0f70066a3a59014d8b9f07d;p=llvm [Debuginfo][SROA] Need to handle dbg.value in SROA pass. SROA pass processes debug info incorrecly if applied twice. Specifically, after SROA works first time, instcombine converts dbg.declare intrinsics into dbg.value. Inlining creates new opportunities for SROA, so it is called again. This time it does not handle correctly previously inserted dbg.value intrinsics. Differential Revision: https://reviews.llvm.org/D64595 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370906 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index a1d1b3ec84f..7242eb1d3de 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -1378,7 +1378,12 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII, /// Determine whether this alloca is either a VLA or an array. static bool isArray(AllocaInst *AI) { return AI->isArrayAllocation() || - AI->getType()->getElementType()->isArrayTy(); + (AI->getAllocatedType() && AI->getAllocatedType()->isArrayTy()); +} + +/// Determine whether this alloca is a structure. +static bool isStructure(AllocaInst *AI) { + return AI->getAllocatedType() && AI->getAllocatedType()->isStructTy(); } /// LowerDbgDeclare - Lowers llvm.dbg.declare intrinsics into appropriate set @@ -1403,7 +1408,7 @@ bool llvm::LowerDbgDeclare(Function &F) { // stored on the stack, while the dbg.declare can only describe // the stack slot (and at a lexical-scope granularity). Later // passes will attempt to elide the stack slot. - if (!AI || isArray(AI)) + if (!AI || isArray(AI) || isStructure(AI)) continue; // A volatile load/store means that the alloca can't be elided anyway. diff --git a/test/DebugInfo/X86/sroa-after-inlining.ll b/test/DebugInfo/X86/sroa-after-inlining.ll new file mode 100644 index 00000000000..5613db3e935 --- /dev/null +++ b/test/DebugInfo/X86/sroa-after-inlining.ll @@ -0,0 +1,139 @@ +; RUN: opt %s -sroa -instcombine -inline -instcombine -sroa -verify -S -o - | FileCheck %s +; +; This test checks that SROA pass processes debug info correctly if applied twice. +; Specifically, after SROA works first time, instcombine converts dbg.declare +; intrinsics into dbg.value. Inlining creates new opportunities for SROA, +; so it is called again. This time it does not handle correctly previously +; inserted dbg.value intrinsics: current SROA implementation while doing +; "Migrate debug information from the old alloca to the new alloca(s)" handles +; only dbg.declare intrinsic. In this case, original dbg.declare was lowered by +; instcombine pass into dbg.value. When it comes into SROA second time, all dbg.value +; intrinsics, inserted by instcombine pass before second SROA, just not updated +; (though SROA was done). The fix is to not lower dbg.declare for structures. + +; +; Hand-reduced from this example (-g -O -mllvm -disable-llvm-optzns -gno-column-info): +; +; struct S1 { +; int p1; +; +; bool IsNull ( ) { return p1 == 0; } +; }; +; +; S1 foo ( void ); +; +; int bar ( ) { +; S1 result = foo(); +; +; if (result.IsNull()) +; return 0; +; +; return result.p1 + 1; +; } + +; CHECK: _Z3barv +; CHECK: %[[RESULT:.*]] = call i32 @_Z3foov +; CHECK: llvm.dbg.value(metadata i32 %[[RESULT]], metadata [[METADATA_IDX1:![0-9]+]] +; CHECK: ret +; CHECK: DICompileUnit +; CHECK: [[METADATA_IDX1]] = !DILocalVariable(name: "result" + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.S1 = type { i32 } + +$_ZN2S16IsNullEv = comdat any + +define dso_local i32 @_Z3barv() !dbg !7 { +entry: + %retval = alloca i32, align 4 + %result = alloca %struct.S1, align 4 + %cleanup.dest.slot = alloca i32, align 4 + %0 = bitcast %struct.S1* %result to i8*, !dbg !21 + call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #5, !dbg !21 + call void @llvm.dbg.declare(metadata %struct.S1* %result, metadata !12, metadata !DIExpression()), !dbg !21 + %call = call i32 @_Z3foov(), !dbg !21 + %coerce.dive = getelementptr inbounds %struct.S1, %struct.S1* %result, i32 0, i32 0, !dbg !21 + store i32 %call, i32* %coerce.dive, align 4, !dbg !21 + %call1 = call zeroext i1 @_ZN2S16IsNullEv(%struct.S1* %result), !dbg !22 + br i1 %call1, label %if.then, label %if.end, !dbg !24 + +if.then: ; preds = %entry + store i32 0, i32* %retval, align 4, !dbg !25 + store i32 1, i32* %cleanup.dest.slot, align 4 + br label %cleanup, !dbg !25 + +if.end: ; preds = %entry + %p1 = getelementptr inbounds %struct.S1, %struct.S1* %result, i32 0, i32 0, !dbg !26 + %1 = load i32, i32* %p1, align 4, !dbg !26 + %add = add nsw i32 %1, 1, !dbg !26 + store i32 %add, i32* %retval, align 4, !dbg !26 + store i32 1, i32* %cleanup.dest.slot, align 4 + br label %cleanup, !dbg !26 + +cleanup: ; preds = %if.end, %if.then + %2 = bitcast %struct.S1* %result to i8*, !dbg !32 + call void @llvm.lifetime.end.p0i8(i64 4, i8* %2) #5, !dbg !32 + %3 = load i32, i32* %retval, align 4, !dbg !32 + ret i32 %3, !dbg !32 +} + +declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) + +declare void @llvm.dbg.declare(metadata, metadata, metadata) + +declare dso_local i32 @_Z3foov() + +define linkonce_odr dso_local zeroext i1 @_ZN2S16IsNullEv(%struct.S1* %this) #4 comdat align 2 !dbg !33 { +entry: + %this.addr = alloca %struct.S1*, align 8 + store %struct.S1* %this, %struct.S1** %this.addr, align 8 + call void @llvm.dbg.declare(metadata %struct.S1** %this.addr, metadata !35, metadata !DIExpression()), !dbg !39 + %this1 = load %struct.S1*, %struct.S1** %this.addr, align 8 + %p1 = getelementptr inbounds %struct.S1, %struct.S1* %this1, i32 0, i32 0, !dbg !40 + %0 = load i32, i32* %p1, align 4, !dbg !40 + %cmp = icmp eq i32 %0, 0, !dbg !40 + ret i1 %cmp, !dbg !40 +} + +declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) +!1 = !DIFile(filename: "sroa-after-inlining.cpp", directory: "") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang"} +!7 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) +!8 = !DISubroutineType(types: !9) +!9 = !{!10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !{!12} +!12 = !DILocalVariable(name: "result", scope: !7, file: !1, line: 10, type: !13) +!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S1", file: !1, line: 1, size: 32, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS2S1") +!14 = !{!15, !16} +!15 = !DIDerivedType(tag: DW_TAG_member, name: "p1", scope: !13, file: !1, line: 2, baseType: !10, size: 32) +!16 = !DISubprogram(name: "IsNull", linkageName: "_ZN2S16IsNullEv", scope: !13, file: !1, line: 4, type: !17, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) +!17 = !DISubroutineType(types: !18) +!18 = !{!19, !20} +!19 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) +!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) +!21 = !DILocation(line: 10, scope: !7) +!22 = !DILocation(line: 12, scope: !23) +!23 = distinct !DILexicalBlock(scope: !7, file: !1, line: 12) +!24 = !DILocation(line: 12, scope: !7) +!25 = !DILocation(line: 13, scope: !23) +!26 = !DILocation(line: 15, scope: !7) +!32 = !DILocation(line: 16, scope: !7) +!33 = distinct !DISubprogram(name: "IsNull", linkageName: "_ZN2S16IsNullEv", scope: !13, file: !1, line: 4, type: !17, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !16, retainedNodes: !34) +!34 = !{!35} +!35 = !DILocalVariable(name: "this", arg: 1, scope: !33, type: !36, flags: DIFlagArtificial | DIFlagObjectPointer) +!36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64) +!39 = !DILocation(line: 0, scope: !33) +!40 = !DILocation(line: 4, scope: !33) diff --git a/test/Transforms/InstCombine/lower-dbg-declare.ll b/test/Transforms/InstCombine/lower-dbg-declare.ll index 44de3fc7531..0277086659a 100644 --- a/test/Transforms/InstCombine/lower-dbg-declare.ll +++ b/test/Transforms/InstCombine/lower-dbg-declare.ll @@ -3,181 +3,112 @@ ; This tests dbg.declare lowering for CallInst users of an alloca. The ; resulting dbg.value expressions should add a deref to the declare's expression. -; Hand-reduced from this example (-g -Og -fsanitize=address): - -; static volatile int sink; -; struct OneElementVector { -; int Element; -; OneElementVector(int Element) : Element(Element) { sink = Element; } -; bool empty() const { return false; } -; }; -; using container = OneElementVector; -; static void escape(container &c) { sink = c.Element; } -; int main() { -; container d1 = {42}; -; while (!d1.empty()) -; escape(d1); -; return 0; -; } - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.13.0" - -%struct.OneElementVector = type { i32 } - -define i1 @escape(%struct.OneElementVector* %d1) { - ret i1 false -} +; Hand-reduced from this example (-g -Og -mllvm -disable-llvm-optzns -gno-column-info): + +; static volatile int sink; +; static void escape(int &c) { sink = c; } +; static bool empty ( int p1 ) { return p1 == 0; } +; int main() { +; int d1 = 42; +; while (!empty(d1)) +; escape(d1); +; return 0; +; } + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@_ZL4sink = internal global i32 0, align 4, !dbg !0 ; CHECK-LABEL: @main -define i32 @main() !dbg !15 { +define dso_local i32 @main() !dbg !12 { entry: - %d1 = alloca %struct.OneElementVector, align 4 - %0 = bitcast %struct.OneElementVector* %d1 to i8*, !dbg !34 - -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var:%.*]], metadata !DIExpression(DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - call void @llvm.dbg.declare(metadata %struct.OneElementVector* %d1, metadata !19, metadata !DIExpression()), !dbg !35 - call i1 @escape(%struct.OneElementVector* %d1) - br label %while.cond, !dbg !37 + %retval = alloca i32, align 4 + %d1 = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %0 = bitcast i32* %d1 to i8*, !dbg !17 + call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4, !dbg !17 +; CHECK: dbg.value(metadata i32 42, metadata [[METADATA_IDX1:![0-9]+]], metadata !DIExpression()) +; CHECK-NEXT: store + call void @llvm.dbg.declare(metadata i32* %d1, metadata !16, metadata !DIExpression()), !dbg !17 + store i32 42, i32* %d1, align 4, !dbg !17 + br label %while.cond, !dbg !22 while.cond: ; preds = %while.body, %entry -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var]], metadata !DIExpression(DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - %call = call i1 @escape(%struct.OneElementVector* %d1), !dbg !38 - %lnot = xor i1 %call, true, !dbg !39 - br i1 %lnot, label %while.body, label %while.end, !dbg !37 +; CHECK: dbg.value(metadata i32 %1, metadata [[METADATA_IDX1]], metadata !DIExpression()) +; CHECK-NEXT: call zeroext i1 @_ZL5emptyi + %1 = load i32, i32* %d1, align 4, !dbg !22 + %call = call zeroext i1 @_ZL5emptyi(i32 %1), !dbg !22 + %lnot = xor i1 %call, true, !dbg !22 + br i1 %lnot, label %while.body, label %while.end, !dbg !22 while.body: ; preds = %while.cond -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var]], metadata !DIExpression(DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - call i1 @escape(%struct.OneElementVector* %d1) - br label %while.cond, !dbg !37, !llvm.loop !42 +; CHECK: dbg.value(metadata i32* %d1, metadata [[METADATA_IDX1]], metadata !DIExpression(DW_OP_deref)) +; CHECK-NEXT: call void @_ZL6escapeRi + call void @_ZL6escapeRi(i32* dereferenceable(4) %d1), !dbg !23 + br label %while.cond, !dbg !22, !llvm.loop !24 while.end: ; preds = %while.cond - ret i32 0, !dbg !45 + %2 = bitcast i32* %d1 to i8*, !dbg !25 + call void @llvm.lifetime.end.p0i8(i64 4, i8* %2) #4, !dbg !25 + ret i32 0, !dbg !26 } -; CHECK-LABEL: @main2 -define i32 @main2() { -entry: - %d1 = alloca %struct.OneElementVector, align 4 - %0 = bitcast %struct.OneElementVector* %d1 to i8*, !dbg !34 - -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var:%.*]], metadata !DIExpression(DW_OP_lit0, DW_OP_mul, DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - call void @llvm.dbg.declare(metadata %struct.OneElementVector* %d1, metadata !19, metadata !DIExpression(DW_OP_lit0, DW_OP_mul)), !dbg !35 - call i1 @escape(%struct.OneElementVector* %d1) - br label %while.cond, !dbg !37 +declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) -while.cond: ; preds = %while.body, %entry -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var]], metadata !DIExpression(DW_OP_lit0, DW_OP_mul, DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - %call = call i1 @escape(%struct.OneElementVector* %d1), !dbg !38 - %lnot = xor i1 %call, true, !dbg !39 - br i1 %lnot, label %while.body, label %while.end, !dbg !37 +declare void @llvm.dbg.declare(metadata, metadata, metadata) -while.body: ; preds = %while.cond -; CHECK: dbg.value(metadata %struct.OneElementVector* [[var]], metadata !DIExpression(DW_OP_lit0, DW_OP_mul, DW_OP_deref)) -; CHECK-NEXT: call i1 @escape - call i1 @escape(%struct.OneElementVector* %d1) - br label %while.cond, !dbg !37, !llvm.loop !42 +define internal zeroext i1 @_ZL5emptyi(i32 %p1) !dbg !27 { + ret i1 false +} -while.end: ; preds = %while.cond - ret i32 0, !dbg !45 +define internal void @_ZL6escapeRi(i32* dereferenceable(4) %c) #3 !dbg !34 { + ret void } -declare void @llvm.dbg.declare(metadata, metadata, metadata) +declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 !llvm.dbg.cu = !{!2} -!llvm.asan.globals = !{!8} -!llvm.module.flags = !{!10, !11, !12, !13} -!llvm.ident = !{!14} +!llvm.module.flags = !{!8, !9, !10} +!llvm.ident = !{!11} + +; CHECK: DIGlobalVariableExpression +; CHECK: [[METADATA_IDX1]] = !DILocalVariable(name: "d1" !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -!1 = distinct !DIGlobalVariable(name: "sink", linkageName: "_ZL4sink", scope: !2, file: !3, line: 1, type: !6, isLocal: true, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 337207) (llvm/trunk 337204)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) -!3 = !DIFile(filename: "test.cc", directory: "/Users/vsk/src/builds/llvm.org-master-RA") +!1 = distinct !DIGlobalVariable(name: "sink", linkageName: "_ZL4sink", scope: !2, file: !3, line: 2, type: !6, isLocal: true, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None) +!3 = !DIFile(filename: "lower-dbg-declare.cpp", directory: "") !4 = !{} !5 = !{!0} !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7) !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!8 = !{} -!9 = !{!"test.cc", i32 1, i32 21} -!10 = !{i32 2, !"Dwarf Version", i32 4} -!11 = !{i32 2, !"Debug Info Version", i32 3} -!12 = !{i32 1, !"wchar_size", i32 4} -!13 = !{i32 7, !"PIC Level", i32 2} -!14 = !{!"clang version 7.0.0 (trunk 337207) (llvm/trunk 337204)"} -!15 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 18, type: !16, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !18) -!16 = !DISubroutineType(types: !17) -!17 = !{!7} -!18 = !{!19} -!19 = !DILocalVariable(name: "d1", scope: !15, file: !3, line: 21, type: !20) -!20 = !DIDerivedType(tag: DW_TAG_typedef, name: "container", file: !3, line: 12, baseType: !21) -!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "OneElementVector", file: !3, line: 3, size: 32, flags: DIFlagTypePassByValue, elements: !22, identifier: "_ZTS16OneElementVector") -!22 = !{!23, !24, !28} -!23 = !DIDerivedType(tag: DW_TAG_member, name: "Element", scope: !21, file: !3, line: 4, baseType: !7, size: 32) -!24 = !DISubprogram(name: "OneElementVector", scope: !21, file: !3, line: 6, type: !25, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true) -!25 = !DISubroutineType(types: !26) -!26 = !{null, !27, !7} -!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) -!28 = !DISubprogram(name: "empty", linkageName: "_ZNK16OneElementVector5emptyEv", scope: !21, file: !3, line: 8, type: !29, isLocal: false, isDefinition: false, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true) -!29 = !DISubroutineType(types: !30) -!30 = !{!31, !32} -!31 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) -!32 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !33, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) -!33 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21) -!34 = !DILocation(line: 21, column: 3, scope: !15) -!35 = !DILocation(line: 21, column: 13, scope: !15) -!36 = !DILocation(line: 21, column: 18, scope: !15) -!37 = !DILocation(line: 22, column: 3, scope: !15) -!38 = !DILocation(line: 22, column: 14, scope: !15) -!39 = !DILocation(line: 22, column: 10, scope: !15) -!40 = !DILocation(line: 23, column: 5, scope: !41) -!41 = distinct !DILexicalBlock(scope: !15, file: !3, line: 22, column: 23) -!42 = distinct !{!42, !37, !43} -!43 = !DILocation(line: 24, column: 3, scope: !15) -!44 = !DILocation(line: 26, column: 1, scope: !15) -!45 = !DILocation(line: 25, column: 3, scope: !15) -!46 = distinct !DISubprogram(name: "OneElementVector", linkageName: "_ZN16OneElementVectorC1Ei", scope: !21, file: !3, line: 6, type: !25, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, declaration: !24, retainedNodes: !47) -!47 = !{!48, !50} -!48 = !DILocalVariable(name: "this", arg: 1, scope: !46, type: !49, flags: DIFlagArtificial | DIFlagObjectPointer) -!49 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 64) -!50 = !DILocalVariable(name: "Element", arg: 2, scope: !46, file: !3, line: 6, type: !7) -!51 = !DILocation(line: 0, scope: !46) -!52 = !DILocation(line: 6, column: 24, scope: !46) -!53 = !DILocation(line: 6, column: 52, scope: !46) -!54 = !DILocation(line: 6, column: 70, scope: !46) -!55 = distinct !DISubprogram(name: "empty", linkageName: "_ZNK16OneElementVector5emptyEv", scope: !21, file: !3, line: 8, type: !29, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !2, declaration: !28, retainedNodes: !56) -!56 = !{!57} -!57 = !DILocalVariable(name: "this", arg: 1, scope: !55, type: !58, flags: DIFlagArtificial | DIFlagObjectPointer) -!58 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !33, size: 64) -!59 = !DILocation(line: 0, scope: !55) -!60 = !DILocation(line: 8, column: 24, scope: !55) -!61 = distinct !DISubprogram(name: "escape", linkageName: "_ZL6escapeR16OneElementVector", scope: !3, file: !3, line: 14, type: !62, isLocal: true, isDefinition: true, scopeLine: 14, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !65) -!62 = !DISubroutineType(types: !63) -!63 = !{null, !64} -!64 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !20, size: 64) -!65 = !{!66} -!66 = !DILocalVariable(name: "c", arg: 1, scope: !61, file: !3, line: 14, type: !64) -!67 = !DILocation(line: 14, column: 31, scope: !61) -!68 = !DILocation(line: 15, column: 12, scope: !61) -!69 = !{!70, !71, i64 0} -!70 = !{!"_ZTS16OneElementVector", !71, i64 0} -!71 = !{!"int", !72, i64 0} -!72 = !{!"omnipotent char", !73, i64 0} -!73 = !{!"Simple C++ TBAA"} -!74 = !DILocation(line: 15, column: 8, scope: !61) -!75 = !{!71, !71, i64 0} -!76 = !DILocation(line: 16, column: 1, scope: !61) -!77 = distinct !DISubprogram(name: "OneElementVector", linkageName: "_ZN16OneElementVectorC2Ei", scope: !21, file: !3, line: 6, type: !25, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, declaration: !24, retainedNodes: !78) -!78 = !{!79, !80} -!79 = !DILocalVariable(name: "this", arg: 1, scope: !77, type: !49, flags: DIFlagArtificial | DIFlagObjectPointer) -!80 = !DILocalVariable(name: "Element", arg: 2, scope: !77, file: !3, line: 6, type: !7) -!81 = !DILocation(line: 0, scope: !77) -!82 = !DILocation(line: 6, column: 24, scope: !77) -!83 = !DILocation(line: 6, column: 35, scope: !77) -!84 = !DILocation(line: 6, column: 59, scope: !85) -!85 = distinct !DILexicalBlock(scope: !77, file: !3, line: 6, column: 52) -!86 = !DILocation(line: 6, column: 70, scope: !77) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{i32 1, !"wchar_size", i32 4} +!11 = !{!"clang"} +!12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 5, type: !13, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !15) +!13 = !DISubroutineType(types: !14) +!14 = !{!7} +!15 = !{!16} +!16 = !DILocalVariable(name: "d1", scope: !12, file: !3, line: 6, type: !7) +!17 = !DILocation(line: 6, scope: !12) +!22 = !DILocation(line: 7, scope: !12) +!23 = !DILocation(line: 8, scope: !12) +!24 = distinct !{!24, !22, !23} +!25 = !DILocation(line: 10, scope: !12) +!26 = !DILocation(line: 9, scope: !12) +!27 = distinct !DISubprogram(name: "empty", linkageName: "_ZL5emptyi", scope: !3, file: !3, line: 4, type: !28, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !31) +!28 = !DISubroutineType(types: !29) +!29 = !{!30, !7} +!30 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) +!31 = !{!32} +!32 = !DILocalVariable(name: "p1", arg: 1, scope: !27, file: !3, line: 4, type: !7) +!33 = !DILocation(line: 4, scope: !27) +!34 = distinct !DISubprogram(name: "escape", linkageName: "_ZL6escapeRi", scope: !3, file: !3, line: 3, type: !35, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !38) +!35 = !DISubroutineType(types: !36) +!36 = !{null, !37} +!37 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !7, size: 64) +!38 = !{!39} +!39 = !DILocalVariable(name: "c", arg: 1, scope: !34, file: !3, line: 3, type: !37) +!42 = !DILocation(line: 3, scope: !34) diff --git a/test/Transforms/Util/simplify-dbg-declare-load.ll b/test/Transforms/Util/simplify-dbg-declare-load.ll index a62e2891ccb..483cf2f6dc8 100644 --- a/test/Transforms/Util/simplify-dbg-declare-load.ll +++ b/test/Transforms/Util/simplify-dbg-declare-load.ll @@ -1,5 +1,6 @@ ; RUN: opt -instcombine -instcombine-lower-dbg-declare=1 -S < %s | FileCheck %s ; RUN: opt -instcombine -instcombine-lower-dbg-declare=0 -S < %s | FileCheck %s --check-prefix=DECLARE +; XFAIL: * target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu"