This is an archive of the discontinued LLVM Phabricator instance.

[DEBUG_INFO, NVPTX] Do not emit .debug_loc section.
ClosedPublic

Authored by ABataev on Jun 28 2018, 10:26 AM.

Details

Summary

.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.

Diff Detail

Repository
rL LLVM

Event Timeline

ABataev created this revision.Jun 28 2018, 10:26 AM

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 ...

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?

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.

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?

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.

ABataev updated this revision to Diff 153378.Jun 28 2018, 1:08 PM

Fixed comment.

probinson accepted this revision.Jun 28 2018, 2:24 PM

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.

This revision is now accepted and ready to land.Jun 28 2018, 2:24 PM
This revision was automatically updated to reflect the committed changes.