summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-28 22:02:32 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-28 22:02:32 +0000
commit178ef0b672909da13fee54597e08c7a40c56e628 (patch)
tree3c054d8b3672d6ff1f01c490ff6c443f86c08e5c /gcc/expr.c
parent265a34f4a21ad8f2285f5e849ef700f560795d22 (diff)
downloadgcc-178ef0b672909da13fee54597e08c7a40c56e628.tar.gz
PR target/60648
* expr.c (do_tablejump): Use simplify_gen_binary rather than gen_rtx_{PLUS,MULT} to build up the address expression. * i386/i386.c (ix86_legitimize_address): Use copy_addr_to_reg to avoid creating non-canonical RTL. PR target/60648 * g++.dg/pr60648.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208924 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index cdb45518d27..ebf136ed5a3 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -11134,11 +11134,12 @@ do_tablejump (rtx index, enum machine_mode mode, rtx range, rtx table_label,
GET_MODE_SIZE, because this indicates how large insns are. The other
uses should all be Pmode, because they are addresses. This code
could fail if addresses and insns are not the same size. */
- index = gen_rtx_PLUS
- (Pmode,
- gen_rtx_MULT (Pmode, index,
- gen_int_mode (GET_MODE_SIZE (CASE_VECTOR_MODE), Pmode)),
- gen_rtx_LABEL_REF (Pmode, table_label));
+ index = simplify_gen_binary (MULT, Pmode, index,
+ gen_int_mode (GET_MODE_SIZE (CASE_VECTOR_MODE),
+ Pmode));
+ index = simplify_gen_binary (PLUS, Pmode, index,
+ gen_rtx_LABEL_REF (Pmode, table_label));
+
#ifdef PIC_CASE_VECTOR_ADDRESS
if (flag_pic)
index = PIC_CASE_VECTOR_ADDRESS (index);