On Wed, Jul 14, 2021 at 05:14:16PM +0800, bin.cheng via Gcc-patches wrote:
> Hi,
> I ran into a wrong code bug in code with deep template instantiation when 
> working on sdx::simd.
> The root cause as described in commit summary is we skip prologue insns in 
> init_alias_analysis.
> This simple patch fixes the issue, however, it's hard to reduce a case 
> because of heavy use of
> templates.

> Subject: [PATCH 1/2] Don't skip prologue instructions as it could affect alias
>  analysis
> 
> In init_alias_analysis, we skip prologue instructions but this is
> wrong as it could affect base value analysis for registers as well
> as following analysis/transformations like cselib and dse:
>   prologue:
>     x12 = 0x1810
>     sp = sp - x12
>   ...
>     ...
>     x12 = SYMBOL_REF(.LC89)
> Here reg_base_value[12] is set to ".LC89", however this is only true
> after the second instruction setting x12.  The patch fixes the issue
> by just handling prologue instructions as normal.  Though ideally it
> can be improved in context-sensitive way.

In what pass do you get the bad behaviour?  dse2?  postreload?  Or what
else?

Your patch looks correct, but I'd like to know why it has seemed to work
for so long :-)


Segher

Reply via email to