llvm.org GIT mirror llvm / 276ef73
Revert "PR20038: DebugInfo: Inlined call sites where the caller has debug info but the call itself has no debug location." This reverts commit r211723. Breaks the ASan/compiler-rt build... guess I didn't test very far at all :/. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211724 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 6 years ago
4 changed file(s) with 50 addition(s) and 102 deletion(s). Raw diff Collapse all Expand all
785785 for (const auto &Var : ConcreteVariables) {
786786 DIE *VariableDie = Var->getDIE();
787787 // FIXME: There shouldn't be any variables without DIEs.
788 assert(VariableDie);
788 if (!VariableDie)
789 continue;
789790 // FIXME: Consider the time-space tradeoff of just storing the unit pointer
790791 // in the ConcreteVariables list, rather than looking it up again here.
791792 // DIE::getUnit isn't simple - it walks parent pointers, etc.
136136 /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
137137 /// not available then create new lexical scope.
138138 LexicalScope *LexicalScopes::getOrCreateLexicalScope(DebugLoc DL) {
139 if (DL.isUnknown())
140 return nullptr;
141139 MDNode *Scope = nullptr;
142140 MDNode *InlinedAt = nullptr;
143141 DL.getScopeAndInlinedAt(Scope, InlinedAt, MF->getFunction()->getContext());
173171 std::make_tuple(Parent, DIDescriptor(Scope),
174172 nullptr, false)).first;
175173
176 if (!Parent) {
177 assert(DIDescriptor(Scope).isSubprogram());
178 assert(DISubprogram(Scope).describes(MF->getFunction()));
179 assert(!CurrentFnLexicalScope);
174 if (!Parent && DIDescriptor(Scope).isSubprogram() &&
175 DISubprogram(Scope).describes(MF->getFunction()))
180176 CurrentFnLexicalScope = &I->second;
181 }
182177
183178 return &I->second;
184179 }
531531 if (isLValueReference() && isRValueReference())
532532 return false;
533533
534 if (auto *F = getFunction()) {
535 LLVMContext &Ctxt = F->getContext();
536 for (auto &BB : *F) {
537 for (auto &I : BB) {
538 DebugLoc DL = I.getDebugLoc();
539 if (DL.isUnknown())
540 continue;
541
542 MDNode *Scope = nullptr;
543 MDNode *IA = nullptr;
544 // walk the inlined-at scopes
545 while (DL.getScopeAndInlinedAt(Scope, IA, F->getContext()), IA)
546 DL = DebugLoc::getFromDILocation(IA);
547 DL.getScopeAndInlinedAt(Scope, IA, Ctxt);
548 assert(!IA);
549 while (!DIDescriptor(Scope).isSubprogram()) {
550 DILexicalBlockFile D(Scope);
551 Scope = D.isLexicalBlockFile()
552 ? D.getScope()
553 : DebugLoc::getFromDILexicalBlock(Scope).getScope(Ctxt);
554 }
555 if (!DISubprogram(Scope).describes(F))
556 return false;
557 }
558 }
559 }
560534 return DbgNode->getNumOperands() == 20;
561535 }
562536
1717 ; CHECK-NOT: DW_TAG
1818 ; CHECK: DW_AT_name {{.*}} "~C"
1919
20 ; CHECK: [[D1_ABS:.*]]: DW_TAG_subprogram
20 ; CHECK: DW_TAG_subprogram
2121 ; CHECK-NOT: DW_TAG
22 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev"
23 ; CHECK-NOT: {{DW_TAG|NULL}}
24 ; CHECK: [[D1_THIS_ABS:.*]]: DW_TAG_formal_parameter
25 ; CHECK-NOT: DW_TAG
26 ; CHECK: DW_AT_name {{.*}} "this"
22 ; CHECK: DW_AT_name {{.*}} "fun4"
23
24 ; FIXME: The dtor is inlined into fun4 and should have an inlined_subroutine
25 ; entry. (it may be necessary to put some non-trivial instruction, such as an
26 ; assignment to a global, in the dtor just to ensure its emission/inlining)
27
28 ; CHECK-NOT: DW_TAG_inlined_subroutine
2729
2830 ; CHECK: DW_TAG_subprogram
2931 ; CHECK-NOT: DW_TAG
30 ; CHECK: DW_AT_name {{.*}} "fun4"
31 ; CHECK-NOT: {{DW_TAG|NULL}}
32 ; CHECK: DW_TAG_lexical_block
33 ; CHECK-NOT: {{DW_TAG|NULL}}
34 ; CHECK: DW_TAG_inlined_subroutine
35 ; CHECK-NOT: DW_TAG
36 ; CHECK: DW_AT_abstract_origin {{.*}} {[[D1_ABS]]}
37 ; CHECK-NOT: {{DW_TAG|NULL}}
38 ; CHECK: DW_TAG_formal_parameter
39 ; CHECK-NOT: DW_TAG
40 ; CHECK: DW_AT_abstract_origin {{.*}} {[[D1_THIS_ABS]]}
32 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev"
4133
42 ; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
43 ; to there being no work in D2 (calling another member function from the dtor
44 ; causes D2 to show up, calling a free function doesn't).
34 ; FIXME: But I think where the real issue is for PR20038 is that the D1 ctor, ;
35 ; calling and inlining D2, doesn't end up with an inlined_subroutine. Though this
36 ; might be more the result of a lack of any actual work in D2 (again, could use
37 ; an assignment to global, etc)
4538
46 ; CHECK-NOT: DW_TAG
47 ; CHECK: NULL
48 ; CHECK-NOT: DW_TAG
49 ; CHECK: NULL
50 ; CHECK-NOT: DW_TAG
51 ; CHECK: NULL
39 ; CHECK-NOT: DW_TAG_inlined_subroutine
5240
5341 %struct.C = type { i8 }
5442
5846 define void @_Z4fun4v() #0 {
5947 entry:
6048 %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
61 %this.addr.i = alloca %struct.C*, align 8, !dbg !22
49 %this.addr.i = alloca %struct.C*, align 8
6250 %agg.tmp.ensured = alloca %struct.C, align 1
6351 %cleanup.cond = alloca i1
64 %0 = load i8* @b, align 1, !dbg !24
65 %tobool = trunc i8 %0 to i1, !dbg !24
52 %0 = load i8* @b, align 1, !dbg !22
53 %tobool = trunc i8 %0 to i1, !dbg !22
6654 store i1 false, i1* %cleanup.cond
67 br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
55 br i1 %tobool, label %land.rhs, label %land.end, !dbg !22
6856
6957 land.rhs: ; preds = %entry
70 store i1 true, i1* %cleanup.cond, !dbg !25
58 store i1 true, i1* %cleanup.cond, !dbg !23
7159 br label %land.end
7260
7361 land.end: ; preds = %land.rhs, %entry
7462 %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
75 %cleanup.is_active = load i1* %cleanup.cond, !dbg !27
76 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
63 %cleanup.is_active = load i1* %cleanup.cond
64 br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done
7765
7866 cleanup.action: ; preds = %land.end
79 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
80 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !29), !dbg !31
81 %this1.i = load %struct.C** %this.addr.i, !dbg !22
67 store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8
68 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !25), !dbg !27
69 %this1.i = load %struct.C** %this.addr.i
8270 store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
83 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i.i}, metadata !32), !dbg !33
71 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i.i}, metadata !28), !dbg !29
8472 %this1.i.i = load %struct.C** %this.addr.i.i, !dbg !21
85 br label %cleanup.done, !dbg !22
73 br label %cleanup.done
8674
8775 cleanup.done: ; preds = %cleanup.action, %land.end
88 ret void, !dbg !34
76 ret void, !dbg !22
8977 }
9078
9179 ; Function Attrs: alwaysinline nounwind
9280 define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 {
9381 entry:
94 %this.addr.i = alloca %struct.C*, align 8, !dbg !37
82 %this.addr.i = alloca %struct.C*, align 8, !dbg !21
9583 %this.addr = alloca %struct.C*, align 8
9684 store %struct.C* %this, %struct.C** %this.addr, align 8
97 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !29), !dbg !38
85 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !25), !dbg !27
9886 %this1 = load %struct.C** %this.addr
99 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
100 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !32), !dbg !39
101 %this1.i = load %struct.C** %this.addr.i, !dbg !37
102 ret void, !dbg !37
87 store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !21
88 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr.i}, metadata !28), !dbg !29
89 %this1.i = load %struct.C** %this.addr.i, !dbg !21
90 ret void, !dbg !21
10391 }
10492
10593 ; Function Attrs: alwaysinline nounwind
10795 entry:
10896 %this.addr = alloca %struct.C*, align 8
10997 store %struct.C* %this, %struct.C** %this.addr, align 8
110 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !32), !dbg !40
98 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !28), !dbg !30
11199 %this1 = load %struct.C** %this.addr
112 ret void, !dbg !41
100 ret void, !dbg !31
113101 }
114102
115103 ; Function Attrs: nounwind readnone
144132 !18 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
145133 !19 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
146134 !20 = metadata !{metadata !"clang version 3.5.0 "}
147 !21 = metadata !{i32 6, i32 0, metadata !17, metadata !22}
148 !22 = metadata !{i32 5, i32 0, metadata !23, null}
149 !23 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 3, i32 3} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
150 !24 = metadata !{i32 5, i32 0, metadata !12, null}
151 !25 = metadata !{i32 5, i32 0, metadata !26, null}
152 !26 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 1, i32 1} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
153 !27 = metadata !{i32 5, i32 0, metadata !28, null}
154 !28 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 2, i32 2} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
155 !29 = metadata !{i32 786689, metadata !17, metadata !"this", null, i32 16777216, metadata !30, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
156 !30 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1C]
157 !31 = metadata !{i32 0, i32 0, metadata !17, metadata !22}
158 !32 = metadata !{i32 786689, metadata !16, metadata !"this", null, i32 16777216, metadata !30, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
159 !33 = metadata !{i32 0, i32 0, metadata !16, metadata !21}
160 !34 = metadata !{i32 5, i32 0, metadata !35, null}
161 !35 = metadata !{i32 786443, metadata !5, metadata !36, i32 5, i32 0, i32 5, i32 5} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
162 !36 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 4, i32 4} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
163 !37 = metadata !{i32 6, i32 0, metadata !17, null}
164 !38 = metadata !{i32 0, i32 0, metadata !17, null}
165 !39 = metadata !{i32 0, i32 0, metadata !16, metadata !37}
166 !40 = metadata !{i32 0, i32 0, metadata !16, null}
167 !41 = metadata !{i32 6, i32 0, metadata !16, null}
135 !21 = metadata !{i32 6, i32 0, metadata !17, null}
136 !22 = metadata !{i32 5, i32 0, metadata !12, null}
137 !23 = metadata !{i32 5, i32 0, metadata !24, null}
138 !24 = metadata !{i32 786443, metadata !5, metadata !12, i32 5, i32 0, i32 1, i32 1} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/PR20038.cpp]
139 !25 = metadata !{i32 786689, metadata !17, metadata !"this", null, i32 16777216, metadata !26, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
140 !26 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1C]
141 !27 = metadata !{i32 0, i32 0, metadata !17, null}
142 !28 = metadata !{i32 786689, metadata !16, metadata !"this", null, i32 16777216, metadata !26, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
143 !29 = metadata !{i32 0, i32 0, metadata !16, metadata !21}
144 !30 = metadata !{i32 0, i32 0, metadata !16, null}
145 !31 = metadata !{i32 6, i32 0, metadata !16, null}