From: Jakub Jelinek Date: Sun, 9 Jun 2013 18:30:01 +0000 (+0200) Subject: re PR rtl-optimization/57568 (wrong code for assignment in conditional at -Os) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e56ed50d74ae33d87353df9a5aff5c247a81349;p=gcc.git re PR rtl-optimization/57568 (wrong code for assignment in conditional at -Os) PR target/57568 * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure that operands[2] doesn't overlap with operands[0]. * gcc.c-torture/execute/pr57568.c: New test. From-SVN: r199870 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30f667a0ce1..2767fbb6904 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-06-09 Jakub Jelinek + + PR target/57568 + * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure + that operands[2] doesn't overlap with operands[0]. + 2013-06-09 David Edelsohn Jan Hubicka diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 018678dc850..e97a4570501 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -16591,6 +16591,7 @@ "(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) && peep2_reg_dead_p (4, operands[0]) && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2]) && (mode != QImode || immediate_operand (operands[2], QImode) || q_regs_operand (operands[2], QImode)) @@ -16655,6 +16656,7 @@ || immediate_operand (operands[2], SImode) || q_regs_operand (operands[2], SImode)) && !reg_overlap_mentioned_p (operands[0], operands[1]) + && !reg_overlap_mentioned_p (operands[0], operands[2]) && ix86_match_ccmode (peep2_next_insn (3), (GET_CODE (operands[3]) == PLUS || GET_CODE (operands[3]) == MINUS) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0628bfa798b..0ba3af62182 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-06-09 Jakub Jelinek + + PR target/57568 + * gcc.c-torture/execute/pr57568.c: New test. + 2013-06-09 Paolo Carlini PR c++/37404 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr57568.c b/gcc/testsuite/gcc.c-torture/execute/pr57568.c new file mode 100644 index 00000000000..9a7ddb0c56f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr57568.c @@ -0,0 +1,12 @@ +/* PR target/57568 */ + +extern void abort (void); +int a[6][9] = { }, b = 1, *c = &a[3][5]; + +int +main () +{ + if (b && (*c = *c + *c)) + abort (); + return 0; +}