Commit 2d1f9c9
authored
Reland "[DebugInfo][DwarfDebug] Separate creation and population of abstract subprogram DIEs" (#160786)
This is an attempt to reland
#159104 with the fix for
#160197.
The original patch had the following problem: when an abstract
subprogram DIE is constructed from within
`DwarfDebug::endFunctionImpl()`,
`DwarfDebug::constructAbstractSubprogramScopeDIE()` acknowledges `unit:`
field of DISubprogram. But an abstract subprogram DIE constructed from
`DwarfDebug::beginModule()` was put in the same compile unit to which
global variable referencing the subprogram belonged, regardless of
subprogram's `unit:`.
This is fixed by adding `DwarfDebug::getOrCreateAbstractSubprogramCU()`
used by both`DwarfDebug:: constructAbstractSubprogramScopeDIE()` and
`DwarfCompileUnit::getOrCreateSubprogramDIE()` when abstract subprogram
is queried during the creation of DIEs for globals in
`DwarfDebug::beginModule()`.
The fix and the already-reviewed code from
#159104 are two separate
commits in this PR.
=====
The original commit message follows:
With this change, construction of abstract subprogram DIEs is split in
two stages/functions: creation of DIE (in
DwarfCompileUnit::getOrCreateAbstractSubprogramDIE) and its population
with children (in
DwarfCompileUnit::constructAbstractSubprogramScopeDIE).
With that, abstract subprograms can be created/referenced from
DwarfDebug::beginModule, which should solve the issue with static local
variables DIE creation of inlined functons with optimized-out
definitions. It fixes #29985.
LexicalScopes class now stores mapping from DISubprograms to their
corresponding llvm::Function's. It is supposed to be built before
processing of each function (so, now LexicalScopes class has a method
for "module initialization" alongside the method for "function
initialization"). It is used by DwarfCompileUnit to determine whether a
DISubprogram needs an abstract DIE before DwarfDebug::beginFunction is
invoked.
DwarfCompileUnit::getOrCreateSubprogramDIE method is added, which can
create an abstract or a concrete DIE for a subprogram. It accepts
llvm::Function* argument to determine whether a concrete DIE must be
created.
This is a temporary fix for
#29985. Ideally, it will be
fixed by moving global variables and types emission to
DwarfDebug::endModule (https://reviews.llvm.org/D144007,
https://reviews.llvm.org/D144005).
Some code proposed by Ellis Hoag <[email protected]> in
#90523 was taken for this
commit.1 parent 5ff9f7b commit 2d1f9c9
File tree
22 files changed
+515
-90
lines changed- llvm
- include/llvm/CodeGen
- lib/CodeGen
- AsmPrinter
- LiveDebugValues
- test
- CodeGen/X86
- DebugInfo
- AArch64
- Generic
- unittests/CodeGen
22 files changed
+515
-90
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | | - | |
149 | | - | |
| 154 | + | |
| 155 | + | |
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| |||
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
199 | 210 | | |
200 | 211 | | |
201 | 212 | | |
| |||
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
228 | 242 | | |
229 | 243 | | |
230 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
272 | | - | |
| 274 | + | |
273 | 275 | | |
274 | 276 | | |
275 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| 540 | + | |
540 | 541 | | |
541 | | - | |
| 542 | + | |
542 | 543 | | |
543 | 544 | | |
544 | 545 | | |
| |||
1122 | 1123 | | |
1123 | 1124 | | |
1124 | 1125 | | |
| 1126 | + | |
1125 | 1127 | | |
1126 | 1128 | | |
1127 | | - | |
| 1129 | + | |
1128 | 1130 | | |
1129 | 1131 | | |
1130 | 1132 | | |
| |||
1198 | 1200 | | |
1199 | 1201 | | |
1200 | 1202 | | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
1206 | 1207 | | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1226 | 1211 | | |
| 1212 | + | |
| 1213 | + | |
1227 | 1214 | | |
1228 | 1215 | | |
1229 | 1216 | | |
| |||
1237 | 1224 | | |
1238 | 1225 | | |
1239 | 1226 | | |
1240 | | - | |
1241 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
1242 | 1266 | | |
1243 | 1267 | | |
1244 | 1268 | | |
| |||
1293 | 1317 | | |
1294 | 1318 | | |
1295 | 1319 | | |
1296 | | - | |
1297 | | - | |
1298 | | - | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
1299 | 1323 | | |
1300 | 1324 | | |
1301 | 1325 | | |
| |||
1305 | 1329 | | |
1306 | 1330 | | |
1307 | 1331 | | |
1308 | | - | |
| 1332 | + | |
1309 | 1333 | | |
1310 | 1334 | | |
1311 | 1335 | | |
| |||
1396 | 1420 | | |
1397 | 1421 | | |
1398 | 1422 | | |
1399 | | - | |
| 1423 | + | |
1400 | 1424 | | |
1401 | 1425 | | |
1402 | 1426 | | |
| |||
1805 | 1829 | | |
1806 | 1830 | | |
1807 | 1831 | | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
146 | 163 | | |
147 | 164 | | |
148 | 165 | | |
| |||
216 | 233 | | |
217 | 234 | | |
218 | 235 | | |
219 | | - | |
| 236 | + | |
| 237 | + | |
220 | 238 | | |
221 | 239 | | |
222 | 240 | | |
| |||
259 | 277 | | |
260 | 278 | | |
261 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
262 | 283 | | |
263 | | - | |
264 | | - | |
| 284 | + | |
| 285 | + | |
265 | 286 | | |
266 | 287 | | |
267 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
268 | 292 | | |
269 | 293 | | |
270 | 294 | | |
| |||
281 | 305 | | |
282 | 306 | | |
283 | 307 | | |
284 | | - | |
| 308 | + | |
285 | 309 | | |
286 | 310 | | |
287 | 311 | | |
288 | 312 | | |
289 | 313 | | |
290 | 314 | | |
291 | | - | |
| 315 | + | |
| 316 | + | |
292 | 317 | | |
293 | 318 | | |
294 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
551 | 561 | | |
552 | 562 | | |
553 | 563 | | |
| |||
559 | 569 | | |
560 | 570 | | |
561 | 571 | | |
562 | | - | |
563 | | - | |
564 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
565 | 575 | | |
566 | 576 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | 577 | | |
571 | 578 | | |
572 | 579 | | |
| |||
997 | 1004 | | |
998 | 1005 | | |
999 | 1006 | | |
1000 | | - | |
1001 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
1002 | 1010 | | |
1003 | 1011 | | |
1004 | 1012 | | |
| |||
2707 | 2715 | | |
2708 | 2716 | | |
2709 | 2717 | | |
2710 | | - | |
| 2718 | + | |
| 2719 | + | |
2711 | 2720 | | |
2712 | 2721 | | |
2713 | 2722 | | |
| |||
2776 | 2785 | | |
2777 | 2786 | | |
2778 | 2787 | | |
2779 | | - | |
| 2788 | + | |
2780 | 2789 | | |
2781 | 2790 | | |
2782 | 2791 | | |
2783 | | - | |
| 2792 | + | |
| 2793 | + | |
2784 | 2794 | | |
2785 | 2795 | | |
2786 | 2796 | | |
| |||
0 commit comments