aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-03-20 09:33:38 +0100
committerJakub Jelinek <jakub@redhat.com>2020-03-20 09:33:38 +0100
commit4119cd693d27e9dd87c547de75283edd45bf6dce (patch)
treed66dc4dfe4d722d9b97f891a9e5c44a431785271
parent05009698eeb925d691a8ebb51539df8d8f28d849 (diff)
downloadgcc-4119cd693d27e9dd87c547de75283edd45bf6dce.zip
gcc-4119cd693d27e9dd87c547de75283edd45bf6dce.tar.gz
gcc-4119cd693d27e9dd87c547de75283edd45bf6dce.tar.bz2
store-merging: Fix up -fnon-call-exceptions handling [PR94224]
When we are adding a single store into a store group, we are already checking that store->lp_nr matches, but we have also code to add further INTEGER_CST stores into the group right away if the ordering requires that either we put there all or none from a certain set of stores. And in those cases we weren't doing these lp_nr checks, which means we could end up with stores with different lp_nr in the same group, which then ICEs during output_merged_store. 2020-03-20 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/94224 * gimple-ssa-store-merging.c (imm_store_chain_info::coalesce_immediate): Don't consider overlapping or adjacent INTEGER_CST rhs_code stores as mergeable if they have different lp_nr. * g++.dg/tree-ssa/pr94224.C: New test.
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple-ssa-store-merging.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr94224.C34
4 files changed, 50 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f7672cc..00dd10c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2020-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94224
+ * gimple-ssa-store-merging.c
+ (imm_store_chain_info::coalesce_immediate): Don't consider overlapping
+ or adjacent INTEGER_CST rhs_code stores as mergeable if they have
+ different lp_nr.
+
2020-03-20 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/arm/arm.md (define_attr "conds"): Fix logic for neon and mve.
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 4d4f549..83ae6c4 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -2773,7 +2773,8 @@ imm_store_chain_info::coalesce_immediate_stores ()
break;
if (info2->order < try_order)
{
- if (info2->rhs_code != INTEGER_CST)
+ if (info2->rhs_code != INTEGER_CST
+ || info2->lp_nr != merged_store->lp_nr)
{
/* Normally check_no_overlap makes sure this
doesn't happen, but if end grows below,
@@ -2791,6 +2792,7 @@ imm_store_chain_info::coalesce_immediate_stores ()
info2->bitpos + info2->bitsize);
}
else if (info2->rhs_code == INTEGER_CST
+ && info2->lp_nr == merged_store->lp_nr
&& !last_iter)
{
max_order = MAX (max_order, info2->order + 1);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 212c6ff..d11f3fe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94224
+ * g++.dg/tree-ssa/pr94224.C: New test.
+
2020-03-19 Jan Hubicka <hubicka@ucw.cz>
PR ipa/94202
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr94224.C b/gcc/testsuite/g++.dg/tree-ssa/pr94224.C
new file mode 100644
index 0000000..5251917
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr94224.C
@@ -0,0 +1,34 @@
+// PR tree-optimization/94224
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions -Wno-return-type" }
+
+void foo (int, int, long);
+
+static inline int
+bar (int &x)
+{
+ x = 0;
+}
+
+struct U
+{
+ int n, p;
+ long q;
+ bool *z;
+ int a;
+ U () : n (), z (), a (1) {}
+ ~U () { if (n) foo (p, n, q); }
+ void baz () { bar (a); }
+};
+
+struct W
+{
+ U w[2];
+ W () { w[0].baz (); }
+};
+
+void
+qux ()
+{
+ new W;
+}