]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: Also cost gconds for scalar [PR118211]
authorAlex Coplan <alex.coplan@arm.com>
Mon, 24 Jun 2024 12:54:48 +0000 (13:54 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 10 Jan 2025 21:21:07 +0000 (21:21 +0000)
Currently we only cost gconds for the vector loop while we omit costing
them when analyzing the scalar loop; this unfairly penalizes the vector
loop in the case of loops with early exits.

This (together with the previous patches) enables us to vectorize
std::find with 64-bit element sizes.

gcc/ChangeLog:

PR tree-optimization/118211
PR tree-optimization/116126
* tree-vect-loop.cc (vect_compute_single_scalar_iteration_cost):
Don't skip over gconds.

gcc/tree-vect-loop.cc

index bb1138bfcfba11b9fd16f9dd321ac0aadf33663c..edd7d4d8763039861d5c238410494f6926785b2c 100644 (file)
@@ -1688,7 +1688,9 @@ vect_compute_single_scalar_iteration_cost (loop_vec_info loop_vinfo)
          gimple *stmt = gsi_stmt (si);
          stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (stmt);
 
-          if (!is_gimple_assign (stmt) && !is_gimple_call (stmt))
+         if (!is_gimple_assign (stmt)
+             && !is_gimple_call (stmt)
+             && !is_a<gcond *> (stmt))
             continue;
 
           /* Skip stmts that are not vectorized inside the loop.  */