1; RUN: llc --stop-after=finalize-isel < %s 2 3; Tests that files with multiple SDNode dependencies are correctly handled by 4; SelectionDAG; dependencies that are incorrectly updated for an SDDbgValue 5; throughout SelectionDAG will result in errors. 6 7target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 8target triple = "x86_64-unknown-linux-gnu" 9 10%class.anon = type { i8 } 11%class.D = type { %class.f } 12%class.f = type { i32, i32 } 13%class.l = type { ptr, i64 } 14%class.d = type { i8 } 15 16@q = internal global %class.anon zeroinitializer, align 1, !dbg !0 17 18define void @_Z1rv() local_unnamed_addr !dbg !30 { 19entry: 20 %t = alloca %class.D, align 4 21 %call = tail call { ptr, i64 } @"_ZN3$_05m_fn3Ev"(ptr nonnull dereferenceable(1) @q), !dbg !60 22 %0 = extractvalue { ptr, i64 } %call, 0, !dbg !60 23 call void @llvm.dbg.value(metadata ptr %0, metadata !34, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !61 24 %1 = extractvalue { ptr, i64 } %call, 1, !dbg !60 25 call void @llvm.dbg.value(metadata i64 %1, metadata !34, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !61 26 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4, !dbg !62 27 call void @llvm.dbg.declare(metadata ptr %t, metadata !35, metadata !DIExpression()), !dbg !63 28 call void @llvm.dbg.value(metadata ptr %0, metadata !64, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !69 29 call void @llvm.dbg.value(metadata i64 %1, metadata !64, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !69 30 call void @llvm.dbg.value(metadata ptr %t, metadata !67, metadata !DIExpression()), !dbg !69 31 call void @llvm.dbg.value(metadata ptr undef, metadata !71, metadata !DIExpression()), !dbg !75 32 call void @llvm.dbg.value(metadata ptr %t, metadata !77, metadata !DIExpression()), !dbg !91 33 call void @llvm.dbg.value(metadata ptr %0, metadata !86, metadata !DIExpression()), !dbg !91 34 call void @llvm.dbg.value(metadata !DIArgList(ptr %0, i64 %1), metadata !87, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_stack_value)), !dbg !91 35 call void @_ZN1dC2EPvl(ptr nonnull dereferenceable(1) %t, ptr nonnull %t, i64 8), !dbg !94 36 call void @llvm.dbg.value(metadata !DIArgList(ptr %0, ptr %0, i64 %1), metadata !88, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 2, DW_OP_constu, 1, DW_OP_mul, DW_OP_plus, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !95 37 %tobool.not.i.i = icmp eq i64 %1, 0, !dbg !96 38 br i1 %tobool.not.i.i, label %_ZN1DILi8EEC2E1l.exit, label %if.then.i.i, !dbg !98 39 40if.then.i.i: ; preds = %entry 41 %add.ptr.i.i = getelementptr inbounds i8, ptr %0, i64 %1, !dbg !99 42 call void @llvm.dbg.value(metadata ptr %add.ptr.i.i, metadata !87, metadata !DIExpression()), !dbg !91 43 call void @llvm.dbg.value(metadata !DIArgList(ptr %add.ptr.i.i, ptr %0), metadata !88, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !95 44 call void @llvm.dbg.value(metadata ptr %t, metadata !77, metadata !DIExpression()), !dbg !91 45 %k.i.i = getelementptr inbounds %class.D, ptr %t, i64 0, i32 0, i32 1, !dbg !100 46 %2 = load i32, ptr %k.i.i, align 4, !dbg !100, !tbaa !101 47 call void @_Z1cIPKciEvT_S2_T0_(ptr %0, ptr nonnull %add.ptr.i.i, i32 %2), !dbg !106 48 br label %_ZN1DILi8EEC2E1l.exit, !dbg !106 49 50_ZN1DILi8EEC2E1l.exit: ; preds = %entry, %if.then.i.i 51 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #4, !dbg !107 52 ret void, !dbg !107 53} 54 55declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) 56 57declare void @llvm.dbg.declare(metadata, metadata, metadata) 58 59declare { ptr, i64 } @"_ZN3$_05m_fn3Ev"(ptr nonnull dereferenceable(1)) local_unnamed_addr 60 61declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) 62 63declare void @_ZN1dC2EPvl(ptr nonnull dereferenceable(1), ptr, i64) unnamed_addr 64 65declare !dbg !108 void @_Z1cIPKciEvT_S2_T0_(ptr, ptr, i32) local_unnamed_addr 66 67declare void @llvm.dbg.value(metadata, metadata, metadata) 68 69!llvm.dbg.cu = !{!2} 70!llvm.module.flags = !{!26, !27, !28} 71!llvm.ident = !{!29} 72 73!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 74!1 = distinct !DIGlobalVariable(name: "q", scope: !2, file: !3, line: 32, type: !6, isLocal: true, isDefinition: true) 75!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 13.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) 76!3 = !DIFile(filename: "dbg-list-dependencies.cpp", directory: "/") 77!4 = !{} 78!5 = !{!0} 79!6 = distinct !DICompositeType(tag: DW_TAG_class_type, file: !3, line: 29, size: 8, flags: DIFlagTypePassByValue, elements: !7) 80!7 = !{!8} 81!8 = !DISubprogram(name: "m_fn3", linkageName: "_ZN3$_05m_fn3Ev", scope: !6, file: !3, line: 31, type: !9, scopeLine: 31, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagOptimized) 82!9 = !DISubroutineType(types: !10) 83!10 = !{!11, !25} 84!11 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "l", file: !3, line: 17, size: 128, flags: DIFlagTypePassByValue, elements: !12, identifier: "_ZTS1l") 85!12 = !{!13, !16, !18, !24} 86!13 = !DIDerivedType(tag: DW_TAG_member, name: "m", scope: !11, file: !3, line: 18, baseType: !14, size: 64) 87!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64) 88!15 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 89!16 = !DIDerivedType(tag: DW_TAG_member, name: "n", scope: !11, file: !3, line: 19, baseType: !17, size: 64, offset: 64) 90!17 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) 91!18 = !DISubprogram(name: "p", linkageName: "_ZN1l1pEv", scope: !11, file: !3, line: 22, type: !19, scopeLine: 22, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 92!19 = !DISubroutineType(types: !20) 93!20 = !{!21, !23} 94!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64) 95!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !15) 96!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 97!24 = !DISubprogram(name: "m_fn2", linkageName: "_ZN1l5m_fn2Ev", scope: !11, file: !3, line: 23, type: !19, scopeLine: 23, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 98!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 99!26 = !{i32 7, !"Dwarf Version", i32 4} 100!27 = !{i32 2, !"Debug Info Version", i32 3} 101!28 = !{i32 1, !"wchar_size", i32 4} 102!29 = !{!"clang version 13.0.0"} 103!30 = distinct !DISubprogram(name: "r", linkageName: "_Z1rv", scope: !3, file: !3, line: 33, type: !31, scopeLine: 33, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !33) 104!31 = !DISubroutineType(types: !32) 105!32 = !{null} 106!33 = !{!34, !35} 107!34 = !DILocalVariable(name: "s", scope: !30, file: !3, line: 34, type: !11) 108!35 = !DILocalVariable(name: "t", scope: !30, file: !3, line: 35, type: !36) 109!36 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "D<8>", file: !3, line: 25, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !37, templateParams: !58, identifier: "_ZTS1DILi8EE") 110!37 = !{!38, !54} 111!38 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !36, baseType: !39, extraData: i32 0) 112!39 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "f<8>", file: !3, line: 6, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !40, templateParams: !52, identifier: "_ZTS1fILi8EE") 113!40 = !{!41, !49, !51} 114!41 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !39, baseType: !42, extraData: i32 0) 115!42 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "d", file: !3, line: 2, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !43, identifier: "_ZTS1d") 116!43 = !{!44} 117!44 = !DISubprogram(name: "d", scope: !42, file: !3, line: 4, type: !45, scopeLine: 4, flags: DIFlagProtected | DIFlagPrototyped, spFlags: DISPFlagOptimized) 118!45 = !DISubroutineType(types: !46) 119!46 = !{null, !47, !48, !17} 120!47 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !42, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 121!48 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) 122!49 = !DIDerivedType(tag: DW_TAG_member, name: "g", scope: !39, file: !3, line: 7, baseType: !50, size: 32) 123!50 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 124!51 = !DIDerivedType(tag: DW_TAG_member, name: "k", scope: !39, file: !3, line: 15, baseType: !50, size: 32, offset: 32, flags: DIFlagPublic) 125!52 = !{!53} 126!53 = !DITemplateValueParameter(name: "e", type: !50, value: i32 8) 127!54 = !DISubprogram(name: "D", scope: !36, file: !3, line: 27, type: !55, scopeLine: 27, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 128!55 = !DISubroutineType(types: !56) 129!56 = !{null, !57, !11} 130!57 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !36, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 131!58 = !{!59} 132!59 = !DITemplateValueParameter(name: "o", type: !50, value: i32 8) 133!60 = !DILocation(line: 34, column: 9, scope: !30) 134!61 = !DILocation(line: 0, scope: !30) 135!62 = !DILocation(line: 35, column: 3, scope: !30) 136!63 = !DILocation(line: 35, column: 8, scope: !30) 137!64 = !DILocalVariable(name: "h", arg: 2, scope: !65, file: !3, line: 27, type: !11) 138!65 = distinct !DISubprogram(name: "D", linkageName: "_ZN1DILi8EEC2E1l", scope: !36, file: !3, line: 27, type: !55, scopeLine: 27, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !54, retainedNodes: !66) 139!66 = !{!67, !64} 140!67 = !DILocalVariable(name: "this", arg: 1, scope: !65, type: !68, flags: DIFlagArtificial | DIFlagObjectPointer) 141!68 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !36, size: 64) 142!69 = !DILocation(line: 0, scope: !65, inlinedAt: !70) 143!70 = distinct !DILocation(line: 35, column: 8, scope: !30) 144!71 = !DILocalVariable(name: "this", arg: 1, scope: !72, type: !74, flags: DIFlagArtificial | DIFlagObjectPointer) 145!72 = distinct !DISubprogram(name: "m_fn2", linkageName: "_ZN1l5m_fn2Ev", scope: !11, file: !3, line: 23, type: !19, scopeLine: 23, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !24, retainedNodes: !73) 146!73 = !{!71} 147!74 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) 148!75 = !DILocation(line: 0, scope: !72, inlinedAt: !76) 149!76 = distinct !DILocation(line: 27, column: 26, scope: !65, inlinedAt: !70) 150!77 = !DILocalVariable(name: "this", arg: 1, scope: !78, type: !90, flags: DIFlagArtificial | DIFlagObjectPointer) 151!78 = distinct !DISubprogram(name: "f<const char *>", linkageName: "_ZN1fILi8EEC2IPKcEET_S4_", scope: !39, file: !3, line: 10, type: !79, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, templateParams: !83, declaration: !82, retainedNodes: !85) 152!79 = !DISubroutineType(types: !80) 153!80 = !{null, !81, !21, !21} 154!81 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !39, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 155!82 = !DISubprogram(name: "f<const char *>", scope: !39, file: !3, line: 10, type: !79, scopeLine: 10, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized, templateParams: !83) 156!83 = !{!84} 157!84 = !DITemplateTypeParameter(name: "a", type: !21) 158!85 = !{!77, !86, !87, !88} 159!86 = !DILocalVariable(name: "h", arg: 2, scope: !78, file: !3, line: 10, type: !21) 160!87 = !DILocalVariable(name: "i", arg: 3, scope: !78, file: !3, line: 10, type: !21) 161!88 = !DILocalVariable(name: "j", scope: !89, file: !3, line: 11, type: !17) 162!89 = distinct !DILexicalBlock(scope: !78, file: !3, line: 10, column: 48) 163!90 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !39, size: 64) 164!91 = !DILocation(line: 0, scope: !78, inlinedAt: !92) 165!92 = distinct !DILocation(line: 27, column: 12, scope: !65, inlinedAt: !70) 166!93 = !DILocation(line: 10, column: 48, scope: !78, inlinedAt: !92) 167!94 = !DILocation(line: 10, column: 39, scope: !78, inlinedAt: !92) 168!95 = !DILocation(line: 0, scope: !89, inlinedAt: !92) 169!96 = !DILocation(line: 12, column: 9, scope: !97, inlinedAt: !92) 170!97 = distinct !DILexicalBlock(scope: !89, file: !3, line: 12, column: 9) 171!98 = !DILocation(line: 12, column: 9, scope: !89, inlinedAt: !92) 172!99 = !DILocation(line: 23, column: 34, scope: !72, inlinedAt: !76) 173!100 = !DILocation(line: 13, column: 15, scope: !97, inlinedAt: !92) 174!101 = !{!102, !103, i64 4} 175!102 = !{!"_ZTS1fILi8EE", !103, i64 0, !103, i64 4} 176!103 = !{!"int", !104, i64 0} 177!104 = !{!"omnipotent char", !105, i64 0} 178!105 = !{!"Simple C++ TBAA"} 179!106 = !DILocation(line: 13, column: 7, scope: !97, inlinedAt: !92) 180!107 = !DILocation(line: 36, column: 1, scope: !30) 181!108 = !DISubprogram(name: "c<const char *, int>", linkageName: "_Z1cIPKciEvT_S2_T0_", scope: !3, file: !3, line: 1, type: !109, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, templateParams: !111, retainedNodes: !4) 182!109 = !DISubroutineType(types: !110) 183!110 = !{null, !21, !21, !50} 184!111 = !{!84, !112} 185!112 = !DITemplateTypeParameter(name: "b", type: !50) 186