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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to