diff options
author | Richard Biener <rguenther@suse.de> | 2023-02-20 10:59:15 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-02-20 11:55:55 +0100 |
commit | 63471c5008819bbf6ec32a6f4d8701fe57b96fa9 (patch) | |
tree | 259f1b22c3d45829cea1f4913ff4d4340a8ca579 /gcc/tree-vect-loop-manip.cc | |
parent | 7b8916a6fd098546e4e53e53b37a5153664ba17f (diff) | |
download | gcc-63471c5008819bbf6ec32a6f4d8701fe57b96fa9.zip gcc-63471c5008819bbf6ec32a6f4d8701fe57b96fa9.tar.gz gcc-63471c5008819bbf6ec32a6f4d8701fe57b96fa9.tar.bz2 |
tree-optimization/108816 - vect versioning check split confusion
The split of the versioning condition assumes the definition is
in the condition block which is ensured by the versioning code.
But that only works when we actually have to insert any statements
for the versioning condition. The following adjusts the guard
accordingly and asserts this condition.
PR tree-optimization/108816
* tree-vect-loop-manip.cc (vect_loop_versioning): Adjust
versioning condition split prerequesite, assert required
invariant.
* gcc.dg/torture/pr108816.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
-rw-r--r-- | gcc/tree-vect-loop-manip.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index c04fcf4..6aa3d2e 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -3477,7 +3477,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo, tree cost_name = NULL_TREE; profile_probability prob2 = profile_probability::uninitialized (); if (cond_expr - && !integer_truep (cond_expr) + && EXPR_P (cond_expr) && (version_niter || version_align || version_alias @@ -3711,6 +3711,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo, if (cost_name && TREE_CODE (cost_name) == SSA_NAME) { gimple *def = SSA_NAME_DEF_STMT (cost_name); + gcc_assert (gimple_bb (def) == condition_bb); /* All uses of the cost check are 'true' after the check we are going to insert. */ replace_uses_by (cost_name, boolean_true_node); |