[PATCH] Fix PR 69282: ICE on 464.h264ref at -O3

Andrew Pinski pinskia@gmail.com
Mon Feb 8 06:22:00 GMT 2016


Hi,
  The problem is that even though expand knows how to expand
VEC_COND<a, b, c> when there is no vcond_mask pattern,
expand_vec_cond_expr_p returns false.  So this patch allows
expand_vec_cond_expr_p to try the next part of the function if there
is no vcond_mask pattern.

OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* optabs-tree.c (expand_vec_cond_expr_p): Don't early return if
get_vcond_mask_icode returns false.

Testsuite/ChangeLog:
* gcc.c-torture/compile/20160205-1.c: New testcase.
-------------- next part --------------
Index: optabs-tree.c
===================================================================
--- optabs-tree.c	(revision 233202)
+++ optabs-tree.c	(working copy)
@@ -323,8 +323,11 @@ expand_vec_cond_expr_p (tree value_type,
   machine_mode value_mode = TYPE_MODE (value_type);
   machine_mode cmp_op_mode = TYPE_MODE (cmp_op_type);
   if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type))
-    return get_vcond_mask_icode (TYPE_MODE (value_type),
-				 TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing;
+    {
+      if (get_vcond_mask_icode (TYPE_MODE (value_type),
+				TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing)
+	return true;
+    }
   if (GET_MODE_SIZE (value_mode) != GET_MODE_SIZE (cmp_op_mode)
       || GET_MODE_NUNITS (value_mode) != GET_MODE_NUNITS (cmp_op_mode)
       || get_vcond_icode (TYPE_MODE (value_type), TYPE_MODE (cmp_op_type),
Index: testsuite/gcc.c-torture/compile/20160205-1.c
===================================================================
--- testsuite/gcc.c-torture/compile/20160205-1.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/20160205-1.c	(working copy)
@@ -0,0 +1,8 @@
+int a[32];
+int fn1(int d) {
+  int c = 1;
+  for (int b = 0; b < 32; b++)
+    if (a[b])
+      c = 0;
+  return c;
+}


More information about the Gcc-patches mailing list