]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/102847 - properly cost VMAT_INVARIANT loads
authorRichard Biener <rguenther@suse.de>
Thu, 21 Oct 2021 08:24:03 +0000 (10:24 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 21 Oct 2021 09:21:18 +0000 (11:21 +0200)
The following adds proper costing of VMAT_INVARIANT loads, avoiding
to ask the target about the cost of an unsupported vector load cost
which we won't emit anyway.

2021-10-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/102847
* tree-vect-stmts.c (vect_model_load_cost): Explicitely
handle VMAT_INVARIANT as a splat in the prologue.

gcc/tree-vect-stmts.c

index 9cbc1af4cc913d07c32f953986159fecea6942e5..8f527452bd0e37b6df04bc1661b061d3d27dce40 100644 (file)
@@ -1191,6 +1191,13 @@ vect_model_load_cost (vec_info *vinfo,
                                       ncopies * assumed_nunits,
                                       scalar_load, stmt_info, 0, vect_body);
     }
+  else if (memory_access_type == VMAT_INVARIANT)
+    {
+      /* Invariant loads will ideally be hoisted and splat to a vector.  */
+      prologue_cost += record_stmt_cost (cost_vec, 1,
+                                        scalar_to_vec, stmt_info, 0,
+                                        vect_prologue);
+    }
   else
     vect_get_load_cost (vinfo, stmt_info, ncopies,
                        alignment_support_scheme, misalignment, first_stmt_p,