diff options
author | Richard Biener <rguenther@suse.de> | 2022-07-05 10:43:42 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-07-05 12:55:32 +0200 |
commit | 1a6e0d8252a71c61d4dc616044fb25b5ac2cfffb (patch) | |
tree | f9d9c891b3f9d3daed3fba008cc258c72e97a25d /gcc | |
parent | 7f4028ae9bbbd35bff34738d5e2f9b6810242ba7 (diff) | |
download | gcc-1a6e0d8252a71c61d4dc616044fb25b5ac2cfffb.zip gcc-1a6e0d8252a71c61d4dc616044fb25b5ac2cfffb.tar.gz gcc-1a6e0d8252a71c61d4dc616044fb25b5ac2cfffb.tar.bz2 |
tree-optimization/106196 - properly update virtual SSA for vector stores
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.
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr106196.c | 14 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.cc | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr106196.c b/gcc/testsuite/gcc.dg/torture/pr106196.c new file mode 100644 index 0000000..56723de --- /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 72107af..3db6620 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); |