diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2016-11-15 18:16:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2016-11-15 18:16:59 +0000 |
commit | 231314e360037e711922ece00817f8c2abc7aec0 (patch) | |
tree | 480ffac9e966d889d8dd72c69996fa9c06069cf4 | |
parent | 3712c7a30197c43bc98d46e344391287da16d7e1 (diff) | |
download | gcc-231314e360037e711922ece00817f8c2abc7aec0.zip gcc-231314e360037e711922ece00817f8c2abc7aec0.tar.gz gcc-231314e360037e711922ece00817f8c2abc7aec0.tar.bz2 |
Use simplify_gen_binary in canon_rtx
After simplifying the operands of a PLUS, canon_rtx checked only
for cases in which one of the simplified operands was a constant,
falling back to gen_rtx_PLUS otherwise. This left the PLUS in a
non-canonical order if one of the simplified operands was
(plus (reg R1) (const_int X)); we'd end up with:
(plus (plus (reg R1) (const_int Y)) (reg R2))
rather than:
(plus (plus (reg R1) (reg R2)) (const_int Y))
Fixing this exposed new DSE opportunities on spu-elf in
gcc.c-torture/execute/builtins/strcat-chk.c but otherwise
it doesn't seem to have much practical effect.
gcc/
2016-11-15 Richard Sandiford <richard.sandiford@arm.com>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* alias.c (canon_rtx): Use simplify_gen_binary.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r242445
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/alias.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a2dd3c..5e3e8a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,12 @@ Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> + * alias.c (canon_rtx): Use simplify_gen_binary. + +2016-11-15 Richard Sandiford <richard.sandiford@arm.com> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + * rtl.h (load_extend_op): Declare. * rtlanal.c (load_extend_op): New function. (nonzero_bits1): Use it. diff --git a/gcc/alias.c b/gcc/alias.c index 1ea2417..546ae7f 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1708,13 +1708,7 @@ canon_rtx (rtx x) rtx x1 = canon_rtx (XEXP (x, 1)); if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1)) - { - if (CONST_INT_P (x0)) - return plus_constant (GET_MODE (x), x1, INTVAL (x0)); - else if (CONST_INT_P (x1)) - return plus_constant (GET_MODE (x), x0, INTVAL (x1)); - return gen_rtx_PLUS (GET_MODE (x), x0, x1); - } + return simplify_gen_binary (PLUS, GET_MODE (x), x0, x1); } /* This gives us much better alias analysis when called from |