Hi!

On Fri, Dec 14, 2018 at 09:21:26AM +0000, senthilkumar.selva...@microchip.com 
wrote:
> This patch fixes PR 88253 by preventing combine_simplify_rtx from
> folding an rtx with side_effects_p to const0_rtx.

> 2018-12-14  Senthil Kumar Selvaraj  <senthilkumar.selva...@microchip.com>
> 
>       PR 88253.c
>       * combine.c (combine_simplify_rtx): Test for side-effects before
>   substituting by zero.
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-12-14  Senthil Kumar Selvaraj  <senthilkumar.selva...@microchip.com>
> 
>       * gcc.target/avr/pr88253.c: New test.

> diff --git gcc/combine.c gcc/combine.c
> index 7e611399f2c..e634e8f5a7e 100644
> --- gcc/combine.c
> +++ gcc/combine.c
> @@ -5978,6 +5978,7 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int 
> in_dest,
>           && known_eq (subreg_lowpart_offset (int_mode, int_op0_mode),
>                        SUBREG_BYTE (x))
>           && HWI_COMPUTABLE_MODE_P (int_op0_mode)
> +         && !side_effects_p (SUBREG_REG (x))
>           && (nonzero_bits (SUBREG_REG (x), int_op0_mode)
>               & GET_MODE_MASK (int_mode)) == 0)
>         return CONST0_RTX (int_mode);

Please move the !side_effects_p test last (it is expensive).  With that,
okay for trunk and backports to 8 and 7.

Thanks!


Segher

Reply via email to