.debug_loc section is not supported for NVPTX target. If there is an
object whose location can change during its lifetime, we do not generate
debug location info for this variable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This seems rather drastic. Nearly all variables will be reported as "optimized away" at any optimization level above -O0.
Have you looked at whether you can identify a single preferred location for the variable?
lib/CodeGen/AsmPrinter/DwarfDebug.cpp | ||
---|---|---|
1201 ↗ | (On Diff #153349) | Typos: ... if .debug_loc section ... |
Thanks for the review, Paul. I agree this is not the best solution. But this is how NVidia toolchain works. It does not allow debug info in optimized code. Debug info may be emitted only at -O0. For other optimization levels, only line number info emission is allowed.
I tried to do this kind of analysis and sometimes we can do it, but I don't think this is necessary as debug info is allowed only for non-optimized code.
BTW, I think that because of support of such simple DWARF version the debug info is allowed only at O0. Or vice versa, they're using such simple debug info only because it is allowed at O0 only. I lean to the first, as I think the original problem is in the oversimplified PTX file format.
Okay. Most compilers don't bother with location lists at -O0, and Clang is among them. So this should be fine for -O0 and won't break your tools at higher optimization. LGTM.