From: Jakub Jelinek Date: Sun, 9 Jun 2013 18:37:51 +0000 (+0200) Subject: re PR rtl-optimization/57568 (wrong code for assignment in conditional at -Os) X-Git-Tag: releases/gcc-4.7.4~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65b30b05c185d70e95d78193ca4148ea678fe850;p=thirdparty%2Fgcc.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: r199872 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6ed9bbf2bfc..f74e049046af 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-05-22 Uros Bizjak PR target/57356 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b0e278e917c8..c76cd6bac52c 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -17194,6 +17194,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)) @@ -17258,6 +17259,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 f80afa0ad46c..d1abd627cc0c 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-06 Tobias Burnus Backport from mainline 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 000000000000..9a7ddb0c56fd --- /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; +}