aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr93434.c36
-rw-r--r--gcc/tree-predcom.c24
4 files changed, 70 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3489428..8507c2e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-28 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/93434
+ * tree-predcom.c (split_data_refs_to_components): Record which
+ components have had aliasing loads removed. Prevent store-store
+ commoning for all such components.
+
2020-01-28 Jakub Jelinek <jakub@redhat.com>
PR target/93418
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e3f7592..eac1820 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2020-01-28 Richard Sandiford <richard.sandiford@arm.com>
+ PR tree-optimization/93434
+ * gcc.c-torture/execute/pr93434.c: New test.
+
+2020-01-28 Richard Sandiford <richard.sandiford@arm.com>
+
PR testsuite/93460
* gcc.dg/torture/pr93170.c: Add -Wpsabi.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr93434.c b/gcc/testsuite/gcc.c-torture/execute/pr93434.c
new file mode 100644
index 0000000..e786252
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr93434.c
@@ -0,0 +1,36 @@
+typedef struct creal_T {
+ double re;
+ double im;
+} creal_T;
+
+#define N 16
+int main() {
+ int k;
+ int i;
+ int j;
+ creal_T t2[N];
+ double inval;
+
+ inval = 1.0;
+ for (j = 0; j < N; ++j) {
+ t2[j].re = 0;
+ t2[j].im = 0;
+ }
+
+ for (j = 0; j < N/4; j++) {
+ i = j * 4;
+ t2[i].re = inval;
+ t2[i].im = inval;
+ k = i + 3;
+ t2[k].re = inval;
+ t2[k].im = inval;
+ t2[i] = t2[k];
+ t2[k].re = inval;
+ }
+
+ for (i = 0; i < 2; ++i)
+ if (t2[i].re != !i || t2[i].im != !i)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 047c7fa..d2dcfe7 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -767,6 +767,7 @@ split_data_refs_to_components (class loop *loop,
/* Don't do store elimination if loop has multiple exit edges. */
bool eliminate_store_p = single_exit (loop) != NULL;
basic_block last_always_executed = last_always_executed_block (loop);
+ auto_bitmap no_store_store_comps;
FOR_EACH_VEC_ELT (datarefs, i, dr)
{
@@ -838,9 +839,13 @@ split_data_refs_to_components (class loop *loop,
else if (DR_IS_READ (dra) && ib != bad)
{
if (ia == bad)
- continue;
+ {
+ bitmap_set_bit (no_store_store_comps, ib);
+ continue;
+ }
else if (!determine_offset (dra, drb, &dummy_off))
{
+ bitmap_set_bit (no_store_store_comps, ib);
merge_comps (comp_father, comp_size, bad, ia);
continue;
}
@@ -848,9 +853,13 @@ split_data_refs_to_components (class loop *loop,
else if (DR_IS_READ (drb) && ia != bad)
{
if (ib == bad)
- continue;
+ {
+ bitmap_set_bit (no_store_store_comps, ia);
+ continue;
+ }
else if (!determine_offset (dra, drb, &dummy_off))
{
+ bitmap_set_bit (no_store_store_comps, ia);
merge_comps (comp_father, comp_size, bad, ib);
continue;
}
@@ -908,6 +917,17 @@ split_data_refs_to_components (class loop *loop,
comp->refs.quick_push (dataref);
}
+ if (eliminate_store_p)
+ {
+ bitmap_iterator bi;
+ EXECUTE_IF_SET_IN_BITMAP (no_store_store_comps, 0, ia, bi)
+ {
+ ca = component_of (comp_father, ia);
+ if (ca != bad)
+ comps[ca]->eliminate_store_p = false;
+ }
+ }
+
for (i = 0; i < n; i++)
{
comp = comps[i];