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
This commit is contained in:
Jakub Jelinek 2013-06-09 20:30:01 +02:00 committed by Jakub Jelinek
parent 5beb165753
commit 3e56ed50d7
4 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-06-09 Jakub Jelinek <jakub@redhat.com>
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 <dje.gcc@gmail.com>
Jan Hubicka <jh@suse.cz>

View File

@ -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>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)

View File

@ -1,3 +1,8 @@
2013-06-09 Jakub Jelinek <jakub@redhat.com>
PR target/57568
* gcc.c-torture/execute/pr57568.c: New test.
2013-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37404

View File

@ -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;
}