]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/88033 (ICE on valid code at -O2 and -O3 on x86-64-linux-gnu...
authorPeter Bergner <bergner@linux.ibm.com>
Mon, 19 Nov 2018 19:35:51 +0000 (19:35 +0000)
committerPeter Bergner <bergner@gcc.gnu.org>
Mon, 19 Nov 2018 19:35:51 +0000 (13:35 -0600)
gcc/
PR rtl-optimization/88033
* ira-lives.c (non_conflicting_reg_copy_p): Skip copies from a register
to itself.  Use HARD_REGISTER_NUM_P.

gcc/testsuite/
PR rtl-optimization/88033
* gcc.target/i386/pr88033.c: New test.

From-SVN: r266282

gcc/ChangeLog
gcc/ira-lives.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr88033.c [new file with mode: 0644]

index 99968490f63ef1e45981d07c8c7ed5e2bb87c9f9..8bea262a5820cbcc579a04e857b4caba48094319 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-19  Peter Bergner  <bergner@linux.ibm.com>
+
+       PR rtl-optimization/88033
+       * ira-lives.c (non_conflicting_reg_copy_p): Skip copies from a register
+       to itself.  Use HARD_REGISTER_NUM_P.
+
 2018-11-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * tree-vect-loop.c (vect_transform_loop): Disable further unrolling
index c5e85b91f48e7423e93aa78c9ed736421b718be0..f74958f18017228feb5f9292cafb361c04979622 100644 (file)
@@ -1083,11 +1083,17 @@ non_conflicting_reg_copy_p (rtx_insn *insn)
   int src_regno = REGNO (SET_SRC (set));
   machine_mode mode = GET_MODE (SET_DEST (set));
 
+  /* By definition, a register does not conflict with itself, therefore we
+     do not have to handle it specially.  Returning NULL_RTX now, helps
+     simplify the callers of this function.  */
+  if (dst_regno == src_regno)
+    return NULL_RTX;
+
   /* Computing conflicts for register pairs is difficult to get right, so
      for now, disallow it.  */
-  if ((dst_regno < FIRST_PSEUDO_REGISTER
+  if ((HARD_REGISTER_NUM_P (dst_regno)
        && hard_regno_nregs (dst_regno, mode) != 1)
-      || (src_regno < FIRST_PSEUDO_REGISTER
+      || (HARD_REGISTER_NUM_P (src_regno)
          && hard_regno_nregs (src_regno, mode) != 1))
     return NULL_RTX;
 
index ba1c5d68aa0fc4ab2c6e6b42cfe10e47661215dc..6a659e736802c010b30187d7ed994d7176b05845 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-19  Peter Bergner  <bergner@linux.ibm.com>
+
+       PR rtl-optimization/88033
+       * gcc.target/i386/pr88033.c: New test.
+
 2018-11-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/aarch64/sve/unroll-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr88033.c b/gcc/testsuite/gcc.target/i386/pr88033.c
new file mode 100644 (file)
index 0000000..d75692c
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+main (long a, long *b, long c)
+{
+  if (!c)
+    return 0;
+  int g;
+  *b = (g & ~3000000000) < 0 ? a : a - g;
+  while (1)
+    ;
+  return 0;
+}