diff mbox

rs6000: Fix peephole

Message ID 20150508142546.GA23571@gate.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool May 8, 2015, 2:25 p.m. UTC
On Fri, May 08, 2015 at 10:18:46AM -0400, David Edelsohn wrote:
> > 2015-05-08  Segher Boessenkool  <segher@kernel.crashing.org>
> >
> >         * config/rs6000/rs6000.md: Require operand inequality in one
> >         of the peepholes.
> 
> Okay.
> 
> Is there an artificial testcase?

I don't have one.  Peepholes require optimisation the be enabled, and
it is hard to get stupid code like this then (a compare of X with X).
But it did trigger a few times in the testsuite with this patch:
diff mbox

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index 46cd6db..8ba14cc 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3892,8 +3892,8 @@  try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	   && XVECLEN (newpat, 0) == 2
 	   && GET_CODE (XVECEXP (newpat, 0, 0)) == SET
 	   && GET_CODE (XVECEXP (newpat, 0, 1)) == SET
-	   && (i1 || set_noop_p (XVECEXP (newpat, 0, 0))
-		  || set_noop_p (XVECEXP (newpat, 0, 1)))
 	   && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != ZERO_EXTRACT
 	   && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != STRICT_LOW_PART
 	   && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != ZERO_EXTRACT