re PR target/52086 (ICE caused by wrong peephole2 for QImode mem += reg followed by test)

PR target/52086
	* config/i386/i386.md (*addqi_2 peephole with SImode addition): Check
	that operands[2] is either immediate, or q_regs_operand.

	* gcc.dg/pr52086.c: New test.

From-SVN: r183830
This commit is contained in:
Jakub Jelinek 2012-02-02 10:04:57 +01:00 committed by Jakub Jelinek
parent 13c931c939
commit 903e49f520
4 changed files with 32 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2012-02-02 Jakub Jelinek <jakub@redhat.com>
PR target/52086
* config/i386/i386.md (*addqi_2 peephole with SImode addition): Check
that operands[2] is either immediate, or q_regs_operand.
PR tree-optimization/52073
* tree-vect-stmts.c (vect_mark_relevant): When checking uses of
a pattern stmt for pattern uses, ignore uses outside of the loop.

View file

@ -1,6 +1,6 @@
;; GCC machine description for IA-32 and x86-64.
;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
;; Free Software Foundation, Inc.
;; Mostly by William Schelter.
;; x86_64 support added by Jan Hubicka
@ -17232,6 +17232,9 @@
&& REG_P (operands[0]) && REG_P (operands[4])
&& REGNO (operands[0]) == REGNO (operands[4])
&& peep2_reg_dead_p (4, operands[0])
&& (<MODE>mode != QImode
|| immediate_operand (operands[2], SImode)
|| q_regs_operand (operands[2], SImode))
&& !reg_overlap_mentioned_p (operands[0], operands[1])
&& ix86_match_ccmode (peep2_next_insn (3),
(GET_CODE (operands[3]) == PLUS

View file

@ -1,5 +1,8 @@
2012-02-02 Jakub Jelinek <jakub@redhat.com>
PR target/52086
* gcc.dg/pr52086.c: New test.
PR tree-optimization/52073
* gcc.c-torture/compile/pr52073.c: New test.

View file

@ -0,0 +1,21 @@
/* PR target/52086 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-fpic" { target fpic } } */
struct S { char a; char b[100]; };
int bar (void);
int baz (int);
void
foo (struct S *x)
{
if (bar () & 1)
{
char c = bar ();
baz (4);
x->a += c;
while (x->a)
x->b[c] = bar ();
}
}