On 4/28/20 2:38 AM, Richard Sandiford wrote:
> I think we should do this in cse_process_notes_1, both to avoid creating
> an invalid MEM in the first place, and so that we handle embedded MEMs
> correctly too.
> 
> Also, the (const:P ...) ought to be there even outside of a MEM.  E.g. we
> ought to have:
> 
>   (set (reg X) (const:P (plus:P (symbol_ref:P S) (const_int D))))
> 
> rather than:
> 
>   (set (reg X) (plus:P (symbol_ref:P S) (const_int D)))

I wondered about things such as this, but I couldn't remember ever
seeing a (const:P ...) wrapped around a constant expression before.
Maybe I just wasn't looking for it???



> Adding a PLUS case would fix this example, but I guess a more general
> fix would be to add a second switch statement (after the first) that
> switches on GET_RTX_CLASS and uses logic like simplify_replace_fn_rtx:
> 
>     case RTX_BIN_ARITH:
>     case RTX_COMM_ARITH:
>       op0 = simplify_replace_fn_rtx (XEXP (x, 0), old_rtx, fn, data);
>       op1 = simplify_replace_fn_rtx (XEXP (x, 1), old_rtx, fn, data);
>       if (op0 == XEXP (x, 0) && op1 == XEXP (x, 1))
>       return x;
>       return simplify_gen_binary (code, mode, op0, op1);

Ok, I'll try this and see whether we survive bootstrap and regtesting.
Thanks!

Peter


Reply via email to