* [PATCH] tree-optimization/106196 - properly update virtual SSA for vector stores
@ 2022-07-05 9:02 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-05 9:02 UTC (permalink / raw)
To: gcc-patches
The following properly handles aggregate returns of the const marked
STORE_LANES internal function to update virtual SSA form on-the-fly
rather than relying on a costly virtual SSA rewrite.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
PR tree-optimization/106196
* tree-vect-stmts.cc (vect_finish_stmt_generation): Properly
handle aggregate returns of calls for VDEF updates.
* gcc.dg/torture/pr106196.c: New testcase.
---
gcc/testsuite/gcc.dg/torture/pr106196.c | 14 ++++++++++++++
gcc/tree-vect-stmts.cc | 6 ++++--
2 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr106196.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr106196.c b/gcc/testsuite/gcc.dg/torture/pr106196.c
new file mode 100644
index 00000000000..56723de42c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106196.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize -fno-vect-cost-model" } */
+
+extern char a[];
+char *b;
+void e() {
+ char *d;
+ int c;
+ d = a;
+ for (; c; c++) {
+ d[2] = d[1] = d[0] = b[c];
+ d += 3;
+ }
+}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 72107afc883..3db6620dd42 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1638,8 +1638,10 @@ vect_finish_stmt_generation (vec_info *vinfo,
&& ((is_gimple_assign (vec_stmt)
&& !is_gimple_reg (gimple_assign_lhs (vec_stmt)))
|| (is_gimple_call (vec_stmt)
- && !(gimple_call_flags (vec_stmt)
- & (ECF_CONST|ECF_PURE|ECF_NOVOPS)))))
+ && (!(gimple_call_flags (vec_stmt)
+ & (ECF_CONST|ECF_PURE|ECF_NOVOPS))
+ || (gimple_call_lhs (vec_stmt)
+ && !is_gimple_reg (gimple_call_lhs (vec_stmt)))))))
{
tree new_vdef = copy_ssa_name (vuse, vec_stmt);
gimple_set_vdef (vec_stmt, new_vdef);
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] tree-optimization/106196 - properly update virtual SSA for vector stores
@ 2022-07-05 9:02 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-05 9:02 UTC (permalink / raw)
To: gcc-patches
The following properly handles aggregate returns of the const marked
STORE_LANES internal function to update virtual SSA form on-the-fly
rather than relying on a costly virtual SSA rewrite.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
PR tree-optimization/106196
* tree-vect-stmts.cc (vect_finish_stmt_generation): Properly
handle aggregate returns of calls for VDEF updates.
* gcc.dg/torture/pr106196.c: New testcase.
---
gcc/testsuite/gcc.dg/torture/pr106196.c | 14 ++++++++++++++
gcc/tree-vect-stmts.cc | 6 ++++--
2 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr106196.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr106196.c b/gcc/testsuite/gcc.dg/torture/pr106196.c
new file mode 100644
index 00000000000..56723de42c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106196.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize -fno-vect-cost-model" } */
+
+extern char a[];
+char *b;
+void e() {
+ char *d;
+ int c;
+ d = a;
+ for (; c; c++) {
+ d[2] = d[1] = d[0] = b[c];
+ d += 3;
+ }
+}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 72107afc883..3db6620dd42 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1638,8 +1638,10 @@ vect_finish_stmt_generation (vec_info *vinfo,
&& ((is_gimple_assign (vec_stmt)
&& !is_gimple_reg (gimple_assign_lhs (vec_stmt)))
|| (is_gimple_call (vec_stmt)
- && !(gimple_call_flags (vec_stmt)
- & (ECF_CONST|ECF_PURE|ECF_NOVOPS)))))
+ && (!(gimple_call_flags (vec_stmt)
+ & (ECF_CONST|ECF_PURE|ECF_NOVOPS))
+ || (gimple_call_lhs (vec_stmt)
+ && !is_gimple_reg (gimple_call_lhs (vec_stmt)))))))
{
tree new_vdef = copy_ssa_name (vuse, vec_stmt);
gimple_set_vdef (vec_stmt, new_vdef);
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] tree-optimization/106196 - properly update virtual SSA for vector stores
@ 2022-07-05 9:02 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-07-05 9:02 UTC (permalink / raw)
To: gcc-patches
The following properly handles aggregate returns of the const marked
STORE_LANES internal function to update virtual SSA form on-the-fly
rather than relying on a costly virtual SSA rewrite.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
PR tree-optimization/106196
* tree-vect-stmts.cc (vect_finish_stmt_generation): Properly
handle aggregate returns of calls for VDEF updates.
* gcc.dg/torture/pr106196.c: New testcase.
---
gcc/testsuite/gcc.dg/torture/pr106196.c | 14 ++++++++++++++
gcc/tree-vect-stmts.cc | 6 ++++--
2 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr106196.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr106196.c b/gcc/testsuite/gcc.dg/torture/pr106196.c
new file mode 100644
index 00000000000..56723de42c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr106196.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize -fno-vect-cost-model" } */
+
+extern char a[];
+char *b;
+void e() {
+ char *d;
+ int c;
+ d = a;
+ for (; c; c++) {
+ d[2] = d[1] = d[0] = b[c];
+ d += 3;
+ }
+}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 72107afc883..3db6620dd42 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1638,8 +1638,10 @@ vect_finish_stmt_generation (vec_info *vinfo,
&& ((is_gimple_assign (vec_stmt)
&& !is_gimple_reg (gimple_assign_lhs (vec_stmt)))
|| (is_gimple_call (vec_stmt)
- && !(gimple_call_flags (vec_stmt)
- & (ECF_CONST|ECF_PURE|ECF_NOVOPS)))))
+ && (!(gimple_call_flags (vec_stmt)
+ & (ECF_CONST|ECF_PURE|ECF_NOVOPS))
+ || (gimple_call_lhs (vec_stmt)
+ && !is_gimple_reg (gimple_call_lhs (vec_stmt)))))))
{
tree new_vdef = copy_ssa_name (vuse, vec_stmt);
gimple_set_vdef (vec_stmt, new_vdef);
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-05 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 9:02 [PATCH] tree-optimization/106196 - properly update virtual SSA for vector stores Richard Biener
2022-07-05 9:02 Richard Biener
2022-07-05 9:02 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).