llvm.org GIT mirror llvm / 3a39415
Temporarily revert "Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information." as it appears to be breaking some LTO constructs. This reverts commit r212203. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212298 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 6 years ago
8 changed file(s) with 42 addition(s) and 210 deletion(s). Raw diff Collapse all Expand all
729729
730730 const Module *M = MMI->getModule();
731731
732 FunctionDIs = makeSubprogramMap(*M);
733
734732 // If module has named metadata anchors then use them, otherwise scan the
735733 // module using debug info finder to collect debug info.
736734 NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
14161414 if (!MMI->hasDebugInfo())
14171415 return;
14181416
1419 auto DI = FunctionDIs.find(MF->getFunction());
1420 if (DI == FunctionDIs.end())
1421 return;
1422
14231417 // Grab the lexical scopes for the function, if we don't have any of those
14241418 // then we're not going to be able to do anything.
14251419 LScopes.initialize(*MF);
14351429 // belongs to so that we add to the correct per-cu line table in the
14361430 // non-asm case.
14371431 LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
1438 assert(FnScope->getScopeNode() == DI->second);
14391432 DwarfCompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
14401433 assert(TheCU && "Unable to find compile unit!");
14411434 if (Asm->OutStreamer.hasRawTextSupport())
15331526 assert(CurFn == MF);
15341527 assert(CurFn != nullptr);
15351528
1536 if (!MMI->hasDebugInfo() || LScopes.empty() ||
1537 !FunctionDIs.count(MF->getFunction())) {
1529 if (!MMI->hasDebugInfo() || LScopes.empty()) {
15381530 // If we don't have a lexical scope for this function then there will
15391531 // be a hole in the range information. Keep note of this by setting the
15401532 // previously used section to nullptr.
329329 DwarfAccelTable AccelNamespace;
330330 DwarfAccelTable AccelTypes;
331331
332 DenseMap FunctionDIs;
333
334332 MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
335333
336334 void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
328328 void computeIntervals();
329329
330330 public:
331 LDVImpl(LiveDebugVariables *ps)
332 : pass(*ps), MF(nullptr), EmitDone(false), ModifiedMF(false) {}
331 LDVImpl(LiveDebugVariables *ps) : pass(*ps), EmitDone(false),
332 ModifiedMF(false) {}
333333 bool runOnMachineFunction(MachineFunction &mf);
334334
335335 /// clear - Release all memory.
336336 void clear() {
337 MF = nullptr;
338337 userValues.clear();
339338 virtRegToEqClass.clear();
340339 userVarMap.clear();
693692 }
694693
695694 bool LDVImpl::runOnMachineFunction(MachineFunction &mf) {
696 clear();
697695 MF = &mf;
698696 LIS = &pass.getAnalysis();
699697 MDT = &pass.getAnalysis();
700698 TRI = mf.getTarget().getRegisterInfo();
699 clear();
701700 LS.initialize(mf);
702701 DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: "
703702 << mf.getName() << " **********\n");
711710
712711 bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {
713712 if (!EnableLDV)
714 return false;
715 if (!FunctionDIs.count(mf.getFunction()))
716713 return false;
717714 if (!pImpl)
718715 pImpl = new LDVImpl(this);
976973
977974 void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
978975 DEBUG(dbgs() << "********** EMITTING LIVE DEBUG VARIABLES **********\n");
979 if (!MF)
980 return;
981976 const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
982977 for (unsigned i = 0, e = userValues.size(); i != e; ++i) {
983978 DEBUG(userValues[i]->print(dbgs(), &MF->getTarget()));
992987 static_cast(pImpl)->emitDebugValues(VRM);
993988 }
994989
995 bool LiveDebugVariables::doInitialization(Module &M) {
996 FunctionDIs = makeSubprogramMap(M);
997 return Pass::doInitialization(M);
998 }
999990
1000991 #ifndef NDEBUG
1001992 void LiveDebugVariables::dump() {
2121 #define LLVM_CODEGEN_LIVEDEBUGVARIABLES_H
2222
2323 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/IR/DebugInfo.h"
2524 #include "llvm/CodeGen/MachineFunctionPass.h"
2625
2726 namespace llvm {
3231
3332 class LiveDebugVariables : public MachineFunctionPass {
3433 void *pImpl;
35 DenseMap FunctionDIs;
3634 public:
3735 static char ID; // Pass identification, replacement for typeid
3836
6563 bool runOnMachineFunction(MachineFunction &) override;
6664 void releaseMemory() override;
6765 void getAnalysisUsage(AnalysisUsage &) const override;
68 bool doInitialization(Module &) override;
6966
7067 };
7168
2323 !llvm.dbg.lv = !{!0, !14, !15, !16, !17, !24, !25, !28}
2424
2525 !0 = metadata !{i32 786689, metadata !1, metadata !"this", metadata !3, i32 11, metadata !12, i32 0, null} ; [ DW_TAG_arg_variable ]
26 !1 = metadata !{i32 786478, metadata !31, metadata !2, metadata !"bar", metadata !"bar", metadata !"_ZN3foo3barEi", i32 11, metadata !9, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 true, i32 (%struct.foo*, i32)* null, null, null, null, i32 11} ; [ DW_TAG_subprogram ]
26 !1 = metadata !{i32 786478, metadata !31, metadata !2, metadata !"bar", metadata !"bar", metadata !"_ZN3foo3barEi", i32 11, metadata !9, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 true, i32 (%struct.foo*, i32)* @_ZN3foo3bazEi, null, null, null, i32 11} ; [ DW_TAG_subprogram ]
2727 !2 = metadata !{i32 786451, metadata !31, metadata !3, metadata !"foo", i32 3, i64 32, i64 32, i64 0, i32 0, null, metadata !5, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [foo] [line 3, size 32, align 32, offset 0] [def] [from ]
2828 !3 = metadata !{i32 786473, metadata !31} ; [ DW_TAG_file_type ]
2929 !4 = metadata !{i32 786449, metadata !31, i32 4, metadata !"4.2.1 LLVM build", i1 true, metadata !"", i32 0, metadata !32, metadata !32, metadata !33, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
5151 entry:
5252 %var1 = alloca %struct.AAA3, align 1
5353 %var2 = alloca %struct.AAA3, align 1
54 tail call void @llvm.dbg.value(metadata !{i32 %param1}, i64 0, metadata !30), !dbg !47
55 tail call void @llvm.dbg.value(metadata !{i32 %param2}, i64 0, metadata !31), !dbg !47
56 tail call void @llvm.dbg.value(metadata !48, i64 0, metadata !32), !dbg !49
57 %tobool = icmp eq i32 %param2, 0, !dbg !50
58 br i1 %tobool, label %if.end, label %if.then, !dbg !50
54 %tobool = icmp eq i32 %param2, 0
55 br i1 %tobool, label %if.end, label %if.then
5956
6057 if.then: ; preds = %entry
61 %call = tail call i8* @_Z5i2stri(i32 %param2), !dbg !52
62 tail call void @llvm.dbg.value(metadata !{i8* %call}, i64 0, metadata !32), !dbg !49
63 br label %if.end, !dbg !54
58 %call = call i8* @_Z5i2stri(i32 %param2)
59 br label %if.end
6460
6561 if.end: ; preds = %entry, %if.then
66 tail call void @llvm.dbg.value(metadata !{%struct.AAA3* %var1}, i64 0, metadata !33), !dbg !55
67 tail call void @llvm.dbg.value(metadata !{%struct.AAA3* %var1}, i64 0, metadata !56), !dbg !57
68 tail call void @llvm.dbg.value(metadata !58, i64 0, metadata !59), !dbg !60
69 %arraydecay.i = getelementptr inbounds %struct.AAA3* %var1, i64 0, i32 0, i64 0, !dbg !61
70 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0)), !dbg !61
71 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var2}, i64 0, metadata !34), !dbg !63
72 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var2}, i64 0, metadata !64), !dbg !65
73 call void @llvm.dbg.value(metadata !58, i64 0, metadata !66), !dbg !67
74 %arraydecay.i5 = getelementptr inbounds %struct.AAA3* %var2, i64 0, i32 0, i64 0, !dbg !68
75 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0)), !dbg !68
76 %tobool1 = icmp eq i32 %param1, 0, !dbg !69
77 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var2}, i64 0, metadata !34), !dbg !63
78 br i1 %tobool1, label %if.else, label %if.then2, !dbg !69
62 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var1}, i64 0, metadata !60)
63 call void @llvm.dbg.value(metadata !62, i64 0, metadata !63)
64 %arraydecay.i = getelementptr inbounds %struct.AAA3* %var1, i64 0, i32 0, i64 0
65 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0))
66 call void @llvm.dbg.declare(metadata !{%struct.AAA3* %var2}, metadata !38)
67 %arraydecay.i5 = getelementptr inbounds %struct.AAA3* %var2, i64 0, i32 0, i64 0
68 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0))
69 %tobool1 = icmp eq i32 %param1, 0
70 br i1 %tobool1, label %if.else, label %if.then2
7971
8072 if.then2: ; preds = %if.end
81 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var2}, i64 0, metadata !71), !dbg !73
82 call void @llvm.dbg.value(metadata !74, i64 0, metadata !75), !dbg !76
83 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8]* @.str1, i64 0, i64 0)), !dbg !76
84 br label %if.end3, !dbg !72
73 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8]* @.str1, i64 0, i64 0))
74 br label %if.end3
8575
8676 if.else: ; preds = %if.end
87 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var2}, i64 0, metadata !77), !dbg !79
88 call void @llvm.dbg.value(metadata !80, i64 0, metadata !81), !dbg !82
89 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8]* @.str2, i64 0, i64 0)), !dbg !82
77 call void @_Z3fooPcjPKc(i8* %arraydecay.i5, i32 4, i8* getelementptr inbounds ([2 x i8]* @.str2, i64 0, i64 0))
9078 br label %if.end3
9179
9280 if.end3: ; preds = %if.else, %if.then2
93 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var1}, i64 0, metadata !33), !dbg !55
94 call void @llvm.dbg.value(metadata !{%struct.AAA3* %var1}, i64 0, metadata !83), !dbg !85
95 call void @llvm.dbg.value(metadata !58, i64 0, metadata !86), !dbg !87
96 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0)), !dbg !87
97 ret void, !dbg !88
81 call void @_Z3fooPcjPKc(i8* %arraydecay.i, i32 4, i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0))
82 ret void
9883 }
9984
100 declare i8* @_Z5i2stri(i32) #1
85 ; Function Attrs: nounwind readnone
86 declare void @llvm.dbg.declare(metadata, metadata) #1
10187
102 declare void @_Z3fooPcjPKc(i8*, i32, i8*) #1
88 declare i8* @_Z5i2stri(i32) #2
89
90 declare void @_Z3fooPcjPKc(i8*, i32, i8*) #2
10391
10492 ; Function Attrs: nounwind readnone
105 declare void @llvm.dbg.value(metadata, i64, metadata) #2
93 declare void @llvm.dbg.value(metadata, i64, metadata) #1
10694
10795 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
108 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
109 attributes #2 = { nounwind readnone }
96 attributes #1 = { nounwind readnone }
97 attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
11098
111 !llvm.dbg.cu = !{!0}
112 !llvm.module.flags = !{!44, !45}
113 !llvm.ident = !{!46}
99 !llvm.module.flags = !{!48, !49}
100 !llvm.ident = !{!50}
114101
115 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 ", i1 true, metadata !"", i32 0, metadata !2, metadata !3, metadata !23, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp] [DW_LANG_C_plus_plus]
116 !1 = metadata !{metadata !"dbg-changes-codegen-branch-folding.cpp", metadata !"/tmp/dbginfo"}
117 !2 = metadata !{}
118 !3 = metadata !{metadata !4}
119 !4 = metadata !{i32 786451, metadata !1, null, metadata !"AAA3", i32 4, i64 32, i64 8, i32 0, i32 0, null, metadata !5, i32 0, null, null, metadata !"_ZTS4AAA3"} ; [ DW_TAG_structure_type ] [AAA3] [line 4, size 32, align 8, offset 0] [def] [from ]
120 !5 = metadata !{metadata !6, metadata !11, metadata !17, metadata !18}
121 !6 = metadata !{i32 786445, metadata !1, metadata !"_ZTS4AAA3", metadata !"text", i32 8, i64 32, i64 8, i64 0, i32 0, metadata !7} ; [ DW_TAG_member ] [text] [line 8, size 32, align 8, offset 0] [from ]
122 !7 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 32, i64 8, i32 0, i32 0, metadata !8, metadata !9, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32, align 8, offset 0] [from char]
123 !8 = metadata !{i32 786468, null, null, metadata !"char", i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
124 !9 = metadata !{metadata !10}
125 !10 = metadata !{i32 786465, i64 0, i64 4} ; [ DW_TAG_subrange_type ] [0, 3]
126 !11 = metadata !{i32 786478, metadata !1, metadata !"_ZTS4AAA3", metadata !"AAA3", metadata !"AAA3", metadata !"", i32 5, metadata !12, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 true, null, null, i32 0, null, i32 5} ; [ DW_TAG_subprogram ] [line 5] [AAA3]
127 !12 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !13, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
128 !13 = metadata !{null, metadata !14, metadata !15}
129 !14 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS4AAA3"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS4AAA3]
130 !15 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
131 !16 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !8} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
132 !17 = metadata !{i32 786478, metadata !1, metadata !"_ZTS4AAA3", metadata !"operator=", metadata !"operator=", metadata !"_ZN4AAA3aSEPKc", i32 6, metadata !12, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 true, null, null, i32 0, null, i32 6} ; [ DW_TAG_subprogram ] [line 6] [operator=]
133 !18 = metadata !{i32 786478, metadata !1, metadata !"_ZTS4AAA3", metadata !"operator const char *", metadata !"operator const char *", metadata !"_ZNK4AAA3cvPKcEv", i32 7, metadata !19, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 true, null, null, i32 0, null, i32 7} ; [ DW_TAG_subprogram ] [line 7] [operator const char *]
134 !19 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !20, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
135 !20 = metadata !{metadata !15, metadata !21}
136 !21 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !22} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from ]
137 !22 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !"_ZTS4AAA3"} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from _ZTS4AAA3]
138 !23 = metadata !{metadata !24, metadata !35, metadata !40}
139 !24 = metadata !{i32 786478, metadata !1, metadata !25, metadata !"bar", metadata !"bar", metadata !"_Z3barii", i32 11, metadata !26, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, void (i32, i32)* @_Z3barii, null, null, metadata !29, i32 11} ; [ DW_TAG_subprogram ] [line 11] [def] [bar]
140 !25 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp]
141 !26 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !27, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
142 !27 = metadata !{null, metadata !28, metadata !28}
143 !28 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
144 !29 = metadata !{metadata !30, metadata !31, metadata !32, metadata !33, metadata !34}
145 !30 = metadata !{i32 786689, metadata !24, metadata !"param1", metadata !25, i32 16777227, metadata !28, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [param1] [line 11]
146 !31 = metadata !{i32 786689, metadata !24, metadata !"param2", metadata !25, i32 33554443, metadata !28, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [param2] [line 11]
147 !32 = metadata !{i32 786688, metadata !24, metadata !"temp", metadata !25, i32 12, metadata !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [temp] [line 12]
148 !33 = metadata !{i32 786688, metadata !24, metadata !"var1", metadata !25, i32 17, metadata !"_ZTS4AAA3", i32 0, i32 0} ; [ DW_TAG_auto_variable ] [var1] [line 17]
149 !34 = metadata !{i32 786688, metadata !24, metadata !"var2", metadata !25, i32 18, metadata !"_ZTS4AAA3", i32 0, i32 0} ; [ DW_TAG_auto_variable ] [var2] [line 18]
150 !35 = metadata !{i32 786478, metadata !1, metadata !"_ZTS4AAA3", metadata !"operator=", metadata !"operator=", metadata !"_ZN4AAA3aSEPKc", i32 6, metadata !12, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, null, null, metadata !17, metadata !36, i32 6} ; [ DW_TAG_subprogram ] [line 6] [def] [operator=]
151 !36 = metadata !{metadata !37, metadata !39}
152 !37 = metadata !{i32 786689, metadata !35, metadata !"this", null, i32 16777216, metadata !38, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
153 !38 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS4AAA3"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS4AAA3]
154 !39 = metadata !{i32 786689, metadata !35, metadata !"value", metadata !25, i32 33554438, metadata !15, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [value] [line 6]
155 !40 = metadata !{i32 786478, metadata !1, metadata !"_ZTS4AAA3", metadata !"AAA3", metadata !"AAA3", metadata !"_ZN4AAA3C2EPKc", i32 5, metadata !12, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, null, null, metadata !11, metadata !41, i32 5} ; [ DW_TAG_subprogram ] [line 5] [def] [AAA3]
156 !41 = metadata !{metadata !42, metadata !43}
157 !42 = metadata !{i32 786689, metadata !40, metadata !"this", null, i32 16777216, metadata !38, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
158 !43 = metadata !{i32 786689, metadata !40, metadata !"value", metadata !25, i32 33554437, metadata !15, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [value] [line 5]
159 !44 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
160 !45 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
161 !46 = metadata !{metadata !"clang version 3.5.0 "}
162 !47 = metadata !{i32 11, i32 0, metadata !24, null}
163 !48 = metadata !{i8* null}
164 !49 = metadata !{i32 12, i32 0, metadata !24, null}
165 !50 = metadata !{i32 14, i32 0, metadata !51, null}
166 !51 = metadata !{i32 786443, metadata !1, metadata !24, i32 14, i32 0, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp]
167 !52 = metadata !{i32 15, i32 0, metadata !53, null}
168 !53 = metadata !{i32 786443, metadata !1, metadata !51, i32 14, i32 0, i32 0, i32 1} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp]
169 !54 = metadata !{i32 16, i32 0, metadata !53, null}
170 !55 = metadata !{i32 17, i32 0, metadata !24, null}
171 !56 = metadata !{i32 786689, metadata !40, metadata !"this", null, i32 16777216, metadata !38, i32 1088, metadata !55} ; [ DW_TAG_arg_variable ] [this] [line 0]
172 !57 = metadata !{i32 0, i32 0, metadata !40, metadata !55}
173 !58 = metadata !{i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0)}
174 !59 = metadata !{i32 786689, metadata !40, metadata !"value", metadata !25, i32 33554437, metadata !15, i32 0, metadata !55} ; [ DW_TAG_arg_variable ] [value] [line 5]
175 !60 = metadata !{i32 5, i32 0, metadata !40, metadata !55}
176 !61 = metadata !{i32 5, i32 0, metadata !62, metadata !55}
177 !62 = metadata !{i32 786443, metadata !1, metadata !40, i32 5, i32 0, i32 0, i32 3} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp]
178 !63 = metadata !{i32 18, i32 0, metadata !24, null}
179 !64 = metadata !{i32 786689, metadata !40, metadata !"this", null, i32 16777216, metadata !38, i32 1088, metadata !63} ; [ DW_TAG_arg_variable ] [this] [line 0]
180 !65 = metadata !{i32 0, i32 0, metadata !40, metadata !63}
181 !66 = metadata !{i32 786689, metadata !40, metadata !"value", metadata !25, i32 33554437, metadata !15, i32 0, metadata !63} ; [ DW_TAG_arg_variable ] [value] [line 5]
182 !67 = metadata !{i32 5, i32 0, metadata !40, metadata !63}
183 !68 = metadata !{i32 5, i32 0, metadata !62, metadata !63}
184 !69 = metadata !{i32 20, i32 0, metadata !70, null}
185 !70 = metadata !{i32 786443, metadata !1, metadata !24, i32 20, i32 0, i32 0, i32 2} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/dbg-changes-codegen-branch-folding.cpp]
186 !71 = metadata !{i32 786689, metadata !35, metadata !"this", null, i32 16777216, metadata !38, i32 1088, metadata !72} ; [ DW_TAG_arg_variable ] [this] [line 0]
187 !72 = metadata !{i32 21, i32 0, metadata !70, null}
188 !73 = metadata !{i32 0, i32 0, metadata !35, metadata !72}
189 !74 = metadata !{i8* getelementptr inbounds ([2 x i8]* @.str1, i64 0, i64 0)}
190 !75 = metadata !{i32 786689, metadata !35, metadata !"value", metadata !25, i32 33554438, metadata !15, i32 0, metadata !72} ; [ DW_TAG_arg_variable ] [value] [line 6]
191 !76 = metadata !{i32 6, i32 0, metadata !35, metadata !72}
192 !77 = metadata !{i32 786689, metadata !35, metadata !"this", null, i32 16777216, metadata !38, i32 1088, metadata !78} ; [ DW_TAG_arg_variable ] [this] [line 0]
193 !78 = metadata !{i32 23, i32 0, metadata !70, null}
194 !79 = metadata !{i32 0, i32 0, metadata !35, metadata !78}
195 !80 = metadata !{i8* getelementptr inbounds ([2 x i8]* @.str2, i64 0, i64 0)}
196 !81 = metadata !{i32 786689, metadata !35, metadata !"value", metadata !25, i32 33554438, metadata !15, i32 0, metadata !78} ; [ DW_TAG_arg_variable ] [value] [line 6]
197 !82 = metadata !{i32 6, i32 0, metadata !35, metadata !78}
198 !83 = metadata !{i32 786689, metadata !35, metadata !"this", null, i32 16777216, metadata !38, i32 1088, metadata !84} ; [ DW_TAG_arg_variable ] [this] [line 0]
199 !84 = metadata !{i32 24, i32 0, metadata !24, null}
200 !85 = metadata !{i32 0, i32 0, metadata !35, metadata !84}
201 !86 = metadata !{i32 786689, metadata !35, metadata !"value", metadata !25, i32 33554438, metadata !15, i32 0, metadata !84} ; [ DW_TAG_arg_variable ] [value] [line 6]
202 !87 = metadata !{i32 6, i32 0, metadata !35, metadata !84}
203 !88 = metadata !{i32 25, i32 0, metadata !24, null}
102 !38 = metadata !{i32 786688, null, metadata !"var2", null, i32 20, null, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [var2] [line 20]
103 !48 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
104 !49 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
105 !50 = metadata !{metadata !"clang version 3.5 (202418)"}
106 !60 = metadata !{i32 786689, null, metadata !"this", null, i32 16777216, null, i32 1088, null} ; [ DW_TAG_arg_variable ] [this] [line 0]
107 !62 = metadata !{i8* getelementptr inbounds ([1 x i8]* @.str, i64 0, i64 0)}
108 !63 = metadata !{i32 786689, null, metadata !"value", null, i32 33554439, null, i32 0, null} ; [ DW_TAG_arg_variable ] [value] [line 7]
7878 !0 = metadata !{i32 786449, metadata !59, i32 4, metadata !"clang version 3.1 ()", i1 true, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !47, metadata !1, metadata !""} ; [ DW_TAG_compile_unit ]
7979 !1 = metadata !{}
8080 !3 = metadata !{metadata !5, metadata !23, metadata !27, metadata !31}
81 !5 = metadata !{i32 720942, metadata !6, null, metadata !"Release", metadata !"Release", metadata !"_ZN17nsAutoRefCnt7ReleaseEv", i32 14, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 ()* @_ZN17nsAutoRefCnt7ReleaseEv , null, metadata !12, metadata !20, i32 14} ; [ DW_TAG_subprogram ] [line 14] [def] [Release]
81 !5 = metadata !{i32 720942, metadata !6, null, metadata !"Release", metadata !"Release", metadata !"_ZN17nsAutoRefCnt7ReleaseEv", i32 14, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32* null, null, metadata !12, metadata !20, i32 14} ; [ DW_TAG_subprogram ] [line 14] [def] [Release]
8282 !6 = metadata !{i32 720937, metadata !59} ; [ DW_TAG_file_type ]
8383 !7 = metadata !{i32 720917, i32 0, null, i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
8484 !8 = metadata !{metadata !9, metadata !10}
9494 !18 = metadata !{}
9595 !20 = metadata !{metadata !22}
9696 !22 = metadata !{i32 786689, metadata !5, metadata !"this", metadata !6, i32 16777230, metadata !10, i32 64, i32 0} ; [ DW_TAG_arg_variable ]
97 !23 = metadata !{i32 720942, metadata !6, null, metadata !"~nsAutoRefCnt", metadata !"~nsAutoRefCnt", metadata !"_ZN17nsAutoRefCntD1Ev", i32 18, metadata !16, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, void ()* @_ZN17nsAutoRefCntD1Ev, null, metadata !15, metadata !24, i32 18} ; [ DW_TAG_subprogram ] [line 18] [def] [~nsAutoRefCnt]
97 !23 = metadata !{i32 720942, metadata !6, null, metadata !"~nsAutoRefCnt", metadata !"~nsAutoRefCnt", metadata !"_ZN17nsAutoRefCntD1Ev", i32 18, metadata !16, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32* null, null, metadata !15, metadata !24, i32 18} ; [ DW_TAG_subprogram ] [line 18] [def] [~nsAutoRefCnt]
9898 !24 = metadata !{metadata !26}
9999 !26 = metadata !{i32 786689, metadata !23, metadata !"this", metadata !6, i32 16777234, metadata !10, i32 64, i32 0} ; [ DW_TAG_arg_variable ]
100100 !27 = metadata !{i32 720942, metadata !6, null, metadata !"~nsAutoRefCnt", metadata !"~nsAutoRefCnt", metadata !"_ZN17nsAutoRefCntD2Ev", i32 18, metadata !16, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32* null, null, metadata !15, metadata !28, i32 18} ; [ DW_TAG_subprogram ] [line 18] [def] [~nsAutoRefCnt]
+0
-51
test/DebugInfo/nodebug.ll less more
None ; REQUIRES: object-emission
1
2 ; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
3
4 ; Test that a nodebug function (a function not appearing in the debug info IR
5 ; metadata subprogram list) with DebugLocs on its IR doesn't cause crashes/does
6 ; the right thing.
7
8 ; Build with clang from the following:
9 ; extern int i;
10 ; inline __attribute__((always_inline)) void f1() {
11 ; i = 3;
12 ; }
13 ;
14 ; __attribute__((nodebug)) void f2() {
15 ; f1();
16 ; }
17
18 ; Check that there's only one DW_TAG_subprogram, nothing for the 'f2' function.
19 ; CHECK: DW_TAG_subprogram
20 ; CHECK-NOT: DW_TAG
21 ; CHECK: DW_AT_name {{.*}} "f1"
22 ; CHECK-NOT: DW_TAG_subprogram
23
24 @i = external global i32
25
26 ; Function Attrs: uwtable
27 define void @_Z2f2v() #0 {
28 entry:
29 store i32 3, i32* @i, align 4, !dbg !11
30 ret void
31 }
32
33 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
34
35 !llvm.dbg.cu = !{!0}
36 !llvm.module.flags = !{!8, !9}
37 !llvm.ident = !{!10}
38
39 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/nodebug.cpp] [DW_LANG_C_plus_plus]
40 !1 = metadata !{metadata !"nodebug.cpp", metadata !"/tmp/dbginfo"}
41 !2 = metadata !{}
42 !3 = metadata !{metadata !4}
43 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"f1", metadata !"f1", metadata !"_Z2f1v", i32 2, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, null, null, null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [f1]
44 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/nodebug.cpp]
45 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
46 !7 = metadata !{null}
47 !8 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
48 !9 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
49 !10 = metadata !{metadata !"clang version 3.5.0 "}
50 !11 = metadata !{i32 3, i32 0, metadata !4, null}