[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #94100)
Jeremy Morse via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 09:22:25 PDT 2024
jmorse wrote:
G'day -- we've got some tests for -O0 that, with this patch applied, generate different code with-and-without the `-g` flag, if `-fdebug-info-for-profiling` is enabled. Example godbolt: https://godbolt.org/z/qooo5Eah1 .
It seems the intention of this patch is generating additional loads and stores with debug-info enabled, which is usually highly undesirable. It's guarded by `-fdebug-info-for-profiling`, however we (Sony) use this flag in a bunch of places, and would prefer it to continue generating stable + consistent code. A couple of possibilities:
* Put this behaviour behind a cc1 flag, I think that was the plan in the original PR?
* Instead of creating an alloca, store+load, and dbg.declare, connect a dbg.value to the relevant pointer Value.
The 2nd point is more work, but it means you're only adding more debug-info, and nothing else. A dbg.value connected to the pointer Value is the inevitable consequence of the alloca+store+load idiom after mem2reg/SROA anyway.
https://github.com/llvm/llvm-project/pull/94100
More information about the cfe-commits
mailing list