tree-optimization/95248 - fix oversight in SM rewrite
authorRichard Biener <rguenther@suse.de>
Fri, 22 May 2020 06:48:04 +0000 (08:48 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 22 May 2020 09:46:40 +0000 (11:46 +0200)
This fixes a leftover early out in determining the sequence of stores
to materialize.

2020-05-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95248
* tree-ssa-loop-im.c (sm_seq_valid_bb): Remove bogus early out.

* gcc.dg/torture/pr95248.c: New testcase.

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr95248.c [new file with mode: 0644]
gcc/tree-ssa-loop-im.c

index 598163590e5f5c586239d64ccfda35ce0215a291..957c1f3c5ef02f89b1069ee023e51078ec1a3e4f 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/95248
+       * tree-ssa-loop-im.c (sm_seq_valid_bb): Remove bogus early out.
+
 2020-05-22  Richard Biener  <rguenther@suse.de>
 
        * tree-vectorizer.h (_slp_tree::_slp_tree): New.
index 6de0c5e89235f54dbdfb9d0b939766b2a1132411..1e8ad06f78addbae558fde2e6838fe6201c72962 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/95248
+       * gcc.dg/torture/pr95248.c: New testcase.
+
 2020-05-21  Patrick Palka  <ppalka@redhat.com>
 
        PR c++/94038
diff --git a/gcc/testsuite/gcc.dg/torture/pr95248.c b/gcc/testsuite/gcc.dg/torture/pr95248.c
new file mode 100644 (file)
index 0000000..f0efcc1
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int32plus } */
+
+int var_2 = -2013646301;
+int var_3 = -1126567434;
+unsigned int var_12 = 1;
+unsigned int var_19;
+unsigned int arr_25 [24] [21] [15] [17] [15] ;
+
+void __attribute__((noipa)) test()
+{
+  for (int a = 0; a < 3; a = 42)
+    for (int b = 0; b < 20; b++)
+      for (int c = 0; c < 4; c = 4)
+        for (int d = 0; d < 6; d += 4)
+          for (int e = 0; e < 4; e += 2) {
+            arr_25[a][b][c][d][e] = var_2 || var_3;
+            var_19 = var_12;
+          }
+}
+
+int main()
+{
+    test();
+    if (var_19 != 1)
+      __builtin_abort ();
+    return 0;
+}
index 63f4ef8883c0b190a77f9e69c486cf380b5b4bef..fcca099355a797efd6533edd354c21a36d23212d 100644 (file)
@@ -2436,8 +2436,6 @@ sm_seq_valid_bb (class loop *loop, basic_block bb, tree vdef,
          /* Use the sequence from the first edge and push SMs down.  */
          for (unsigned i = 0; i < first_edge_seq.length (); ++i)
            {
-             if (first_edge_seq[i].second == sm_other)
-               break;
              unsigned id = first_edge_seq[i].first;
              seq.safe_push (first_edge_seq[i]);
              unsigned new_idx;