[clang] [llvm] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #94100)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 09:54:10 PDT 2024


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

I hope that isn't the intent, I thought the intent was just to add more debug info for loads and stores to carry more intermediate type information.

Sorry I missed that this patch does change clangs generated ir. Seriously overlooked on my part.

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

Yeah, pretty sure (2) would be the preferred direction.


https://github.com/llvm/llvm-project/pull/94100


More information about the cfe-commits mailing list