re PR tree-optimization/60559 (g++.dg/vect/pr60023.cc fails with -fno-tree-dce (ICE))
authorJakub Jelinek <jakub@redhat.com>
Wed, 19 Mar 2014 09:13:32 +0000 (10:13 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 19 Mar 2014 09:13:32 +0000 (10:13 +0100)
PR tree-optimization/60559
* vectorizable_mask_load_store): Replace scalar MASK_LOAD
with build_zero_cst assignment.

* g++.dg/vect/pr60559.cc: New test.

From-SVN: r208676

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/vect/pr60559.cc [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 6f408a5b13da18a826aac7bf4137c9b01e12459d..5785c61919cb68f997db457125f02de4c69caca4 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/60559
+       * vectorizable_mask_load_store): Replace scalar MASK_LOAD
+       with build_zero_cst assignment.
+
 2014-03-18  Kai Tietz  <ktietz@redhat.com>
 
        PR rtl-optimization/56356
index d41d926f858d987caba17467be66c78ebf6c1840..67cf9ddc6f5fe25653093ebb9f628b35c736c3e8 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/60559
+       * g++.dg/vect/pr60559.cc: New test.
+
 2014-03-18  Ian Lance Taylor  <iant@google.com>
 
        PR target/60563
diff --git a/gcc/testsuite/g++.dg/vect/pr60559.cc b/gcc/testsuite/g++.dg/vect/pr60559.cc
new file mode 100644 (file)
index 0000000..f179a1a
--- /dev/null
@@ -0,0 +1,8 @@
+// PR tree-optimization/60559
+// { dg-do compile }
+// { dg-additional-options "-O3 -std=c++11 -fnon-call-exceptions -fno-tree-dce" }
+// { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } }
+
+#include "pr60023.cc"
+
+// { dg-final { cleanup-tree-dump "vect" } }
index 70fb411f8f5443ab89115be5998da1fb227beb9b..884e769c8848a7a8e31c062636b4187e48f9162e 100644 (file)
@@ -2038,6 +2038,15 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi,
            STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
          prev_stmt_info = vinfo_for_stmt (new_stmt);
        }
+
+      /* Ensure that even with -fno-tree-dce the scalar MASK_LOAD is removed
+        from the IL.  */
+      tree lhs = gimple_call_lhs (stmt);
+      new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
+      set_vinfo_for_stmt (new_stmt, stmt_info);
+      set_vinfo_for_stmt (stmt, NULL);
+      STMT_VINFO_STMT (stmt_info) = new_stmt;
+      gsi_replace (gsi, new_stmt, true);
       return true;
     }
   else if (is_store)
@@ -2149,6 +2158,18 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi,
        }
     }
 
+  if (!is_store)
+    {
+      /* Ensure that even with -fno-tree-dce the scalar MASK_LOAD is removed
+        from the IL.  */
+      tree lhs = gimple_call_lhs (stmt);
+      new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
+      set_vinfo_for_stmt (new_stmt, stmt_info);
+      set_vinfo_for_stmt (stmt, NULL);
+      STMT_VINFO_STMT (stmt_info) = new_stmt;
+      gsi_replace (gsi, new_stmt, true);
+    }
+
   return true;
 }