re PR tree-optimization/53748 (ice in fold_convert_loc)
authorJakub Jelinek <jakub@redhat.com>
Tue, 26 Jun 2012 08:02:20 +0000 (10:02 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 26 Jun 2012 08:02:20 +0000 (10:02 +0200)
PR tree-optimization/53748
* tree-ssa-phiopt.c (conditional_replacement): Only optimize
if arg0/arg1 have integral or pointer types.

* gcc.c-torture/compile/pr53748.c: New test.

From-SVN: r188975

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr53748.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c

index 677e813033f3fa096328c6ed3ca95a39ddad9c21..d662298de990b8b8bca849911537cf96223fc804 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/53748
+       * tree-ssa-phiopt.c (conditional_replacement): Only optimize
+       if arg0/arg1 have integral or pointer types.
+
 2012-06-25  Richard Henderson  <rth@redhat.com>
 
        * config/i386/sse.md (sse2_sse4_1): Remove code attr.
index a85b990ee8de8d863ce51aa86ac9a7a37fed9e1a..a307459156382b592432c1769b065aa26bdd6fbe 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/53748
+       * gcc.c-torture/compile/pr53748.c: New test.
+
 2012-06-25  Jason Merrill  <jason@redhat.com>
 
        PR c++/53498
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53748.c b/gcc/testsuite/gcc.c-torture/compile/pr53748.c
new file mode 100644 (file)
index 0000000..9aad70d
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR tree-optimization/53748 */
+
+typedef unsigned int V __attribute__ ((__vector_size__ (sizeof (int) * 4)));
+
+void
+foo (int x, V *y)
+{
+  *y = x ? ((V) { ~0U, ~0U, ~0U, ~0U }) : ((V) { 0, 0, 0, 0 });
+}
index 52be15006d07be986568aba4557f19d4b7dbb53d..46d8a2c4e603bad441d96faebceedb539ba068b4 100644 (file)
@@ -615,8 +615,12 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
   bool neg;
 
   /* FIXME: Gimplification of complex type is too hard for now.  */
-  if (TREE_CODE (TREE_TYPE (arg0)) == COMPLEX_TYPE
-      || TREE_CODE (TREE_TYPE (arg1)) == COMPLEX_TYPE)
+  /* We aren't prepared to handle vectors either (and it is a question
+     if it would be worthwhile anyway).  */
+  if (!(INTEGRAL_TYPE_P (TREE_TYPE (arg0))
+       || POINTER_TYPE_P (TREE_TYPE (arg0)))
+      || !(INTEGRAL_TYPE_P (TREE_TYPE (arg1))
+          || POINTER_TYPE_P (TREE_TYPE (arg1))))
     return false;
 
   /* The PHI arguments have the constants 0 and 1, or 0 and -1, then