When looking deeper into the problem I discovered that very sometimes
try_combine is called with the same insn for I1 and I2.  This is quite
bad since try_combine does not expect that at all.  I expect this is
caused by my patches adding a LOG_LINK per register, which can mean
a pair of insns has more than one LOG_LINK between them.

This patch fixes it by making try_combine refuse identical insns early.

Bootstrapped on powerpc64-linux and powerpc-linux; the fails are gone.
Also bootstrapped on x86_64-linux.
Is this okay for mainline?  (regtest on powerpc64-linux in process).


Segher


2014-12-15  Segher Boessenkool  <seg...@kernel.crashing.org>

gcc/
        PR target/64268
        * combine.c (try_combine): Immediately return if any of I0,I1,I2
        are the same insn.


---
 gcc/combine.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/combine.c b/gcc/combine.c
index de2e49f..8e5d1f7 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2620,6 +2620,11 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
   rtx new_other_notes;
   int i;
 
+  /* Immediately return if any of I0,I1,I2 are the same insn (I3 can
+     never be).  */
+  if (i1 == i2 || i0 == i2 || (i0 && i0 == i1))
+    return 0;
+
   /* Only try four-insn combinations when there's high likelihood of
      success.  Look for simple insns, such as loads of constants or
      binary operations involving a constant.  */
-- 
1.8.1.4

Reply via email to