+2017-08-01 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/81620
+ * tree-predcom.c (add_ref_to_chain): Don't set has_max_use_after
+ for store-store chain.
+
2017-08-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/81588
+2017-08-01 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/81620
+ * gcc.dg/tree-ssa/pr81620-1.c: New.
+ * gcc.dg/tree-ssa/pr81620-2.c: New.
+
2017-08-01 Dominique d'Humieres <dominiq@lps.ens.fr>
PR testsuite/53542
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a[7];
+char b;
+void abort (void);
+
+int main() {
+ b = 4;
+ for (; b; b--) {
+ a[b] = b;
+ a[b + 2] = 1;
+ }
+ if (a[0] != 0 || a[1] != 1 || a[2] != 2
+ || a[3] != 1 || a[4] != 1 || a[5] != 1 || a[6] != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-loop-vectorize -fdump-tree-pcom-details" } */
+
+int a[200];
+char b;
+void abort (void);
+
+int main() {
+ int i;
+ b = 100;
+ for (; b; b--) {
+ a[b] = 2;
+ a[b + 2] = 1;
+ }
+
+ if (a[0] != 0 || a[1] != 2 || a[2] != 2)
+ abort ();
+ for (i = 3; i < 103; i++)
+ if (a[i] != 1)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Store-stores chain" 1 "pcom" } } */
chain->has_max_use_after = false;
}
- if (ref->distance == chain->length
+ /* Don't set the flag for store-store chain since there is no use. */
+ if (chain->type != CT_STORE_STORE
+ && ref->distance == chain->length
&& ref->pos > root->pos)
chain->has_max_use_after = true;