aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-30 13:39:59 +0100
committerRichard Biener <rguenther@suse.de>2020-11-30 14:29:57 +0100
commitebbe3f29518854c36574adbd4fa82fd56fa64056 (patch)
tree94cf39775563bbeaf504bf34ca9b268a08450dd4 /gcc/tree-vect-loop.c
parent1e5c644fb62e3e1757cf74fe8a14873d5e8ba53e (diff)
downloadgcc-ebbe3f29518854c36574adbd4fa82fd56fa64056.zip
gcc-ebbe3f29518854c36574adbd4fa82fd56fa64056.tar.gz
gcc-ebbe3f29518854c36574adbd4fa82fd56fa64056.tar.bz2
tree-optimization/98064 - fix BB SLP live lane extract wrt LC SSA
This avoids breaking LC SSA when SLP codegen pulled an out-of-loop def into a loop when merging with in-loop defs for an external def. 2020-11-30 Richard Biener <rguenther@suse.de> PR tree-optimization/98064 * tree-vect-loop.c (vectorizable_live_operation): Avoid breaking LC SSA for BB vectorization. * g++.dg/vect/pr98064.cc: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 48dfb4d..c8b4dc3 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -8743,6 +8743,24 @@ vectorizable_live_operation (vec_info *vinfo,
"def\n");
continue;
}
+ /* ??? It can also happen that we end up pulling a def into
+ a loop where replacing out-of-loop uses would require
+ a new LC SSA PHI node. Retain the original scalar in
+ those cases as well. PR98064. */
+ if (TREE_CODE (new_tree) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (new_tree)
+ && (gimple_bb (use_stmt)->loop_father
+ != gimple_bb (vec_stmt)->loop_father)
+ && !flow_loop_nested_p (gimple_bb (vec_stmt)->loop_father,
+ gimple_bb (use_stmt)->loop_father))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Using original scalar computation for "
+ "live lane because there is an out-of-loop "
+ "definition for it\n");
+ continue;
+ }
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
SET_USE (use_p, new_tree);
update_stmt (use_stmt);