tree-optimization/110436 - bogus live/relevant for unused pattern
Checks
Commit Message
When we compute liveness and relevantness we have to make sure to
handle live but not relevant stmts in a way we can later vectorize
them. When the stmt uses only operands that do not need vectorization
we can just leave such stmts in place - but not in the case they
are recognized as patterns. Since we don't have a way to cancel
pattern recognition we have to force mark such stmts as relevant.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/110436
* tree-vect-stmts.cc (vect_mark_relevant): Expand dumping,
force live but not relevant pattern stmts relevant.
* gcc.dg/pr110436.c: New testcase.
---
gcc/testsuite/gcc.dg/pr110436.c | 4 ++++
gcc/tree-vect-stmts.cc | 15 +++++++++++++++
2 files changed, 19 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/pr110436.c
new file mode 100644
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include "pr83089.c"
@@ -261,11 +261,26 @@ vect_mark_relevant (vec<stmt_vec_info> *worklist, stmt_vec_info stmt_info,
dump_printf_loc (MSG_NOTE, vect_location,
"last stmt in pattern. don't mark"
" relevant/live.\n");
+
stmt_vec_info old_stmt_info = stmt_info;
stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
gcc_assert (STMT_VINFO_RELATED_STMT (stmt_info) == old_stmt_info);
save_relevant = STMT_VINFO_RELEVANT (stmt_info);
save_live_p = STMT_VINFO_LIVE_P (stmt_info);
+
+ if (live_p && relevant == vect_unused_in_scope)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vec_stmt_relevant_p: forcing live patern stmt "
+ "relevant.\n");
+ relevant = vect_used_only_live;
+ }
+
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "mark relevant %d, live %d: %G", relevant, live_p,
+ stmt_info->stmt);
}
STMT_VINFO_LIVE_P (stmt_info) |= live_p;