[committed] Fix ARM ICE in arm_select_dominance_cc_mode (PR target/53187)

Jakub Jelinek jakub@redhat.com
Thu May 3 10:27:00 GMT 2012


Hi!

This patch fixes ICE in arm_select_dominance_cc_mode during combine,
which tries to match some rtl expression which has (unlt:SI (reg:CCFPE cc) (const_int 0))
deep inside it (the match will fail), during simplification SELECT_CC_MODE is used
and as arm_select_cc_mode returns CCmode for the unlt operands, which
arm_select_dominance_cc_mode isn't prepared to handle, we ICE.
Fixed by just returning the MODE_CC class mode from arm_select_cc_mode
(i.e. already earlier selected mode).

Bootstrapped on armv7hl, bootstrap pending on armv5tel, regtest pending
on both, tested and acked by Nick in the PR, committed to trunk/4.7.

2012-05-03  Jakub Jelinek  <jakub@redhat.com>

	PR target/53187
	* config/arm/arm.c (arm_select_cc_mode): If x has MODE_CC class
	mode, return that mode.

	* gcc.target/arm/pr53187.c: New test.
	* gcc.c-torture/compile/pr53187.c: New test.

--- gcc/config/arm/arm.c.jj	2012-05-02 09:38:35.000000000 +0200
+++ gcc/config/arm/arm.c	2012-05-02 11:19:51.582016484 +0200
@@ -11964,6 +11964,9 @@ arm_select_cc_mode (enum rtx_code op, rt
 	}
     }
 
+  if (GET_MODE_CLASS (GET_MODE (x)) == MODE_CC)
+    return GET_MODE (x);
+
   return CCmode;
 }
 
--- gcc/testsuite/gcc.target/arm/pr53187.c.jj	2012-05-02 11:36:43.058192951 +0200
+++ gcc/testsuite/gcc.target/arm/pr53187.c	2012-05-02 11:36:39.224212716 +0200
@@ -0,0 +1,13 @@
+/* PR target/53187 */
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mfloat-abi=hard -O2" } */
+
+void bar (int);
+
+void
+foo (int x, double y, double z)
+{
+  _Bool t = z >= y;
+  if (!t || x)
+    bar (t ? 1 : 16);
+}
--- gcc/testsuite/gcc.c-torture/compile/pr53187.c.jj	2012-05-02 11:36:58.053105849 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr53187.c	2012-05-02 11:37:09.470039372 +0200
@@ -0,0 +1,11 @@
+/* PR target/53187 */
+
+void bar (int);
+
+void
+foo (int x, double y, double z)
+{
+  _Bool t = z >= y;
+  if (!t || x)
+    bar (t ? 1 : 16);
+}

	Jakub



More information about the Gcc-patches mailing list