tree-optimization/104582 - Simplify vectorizer cost API and fixes
authorRichard Biener <rguenther@suse.de>
Fri, 18 Feb 2022 10:34:52 +0000 (11:34 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 22 Feb 2022 06:48:31 +0000 (07:48 +0100)
commit61fc5e098e76c9809f35f449a70c9c8d74773d9d
tree88ba61d8bf23b71c317bf909b8adc8b8cad4d84e
parent0435b978f95971e139882549f5a1765c50682216
tree-optimization/104582 - Simplify vectorizer cost API and fixes

This simplifies the vectorizer cost API by providing overloads
to add_stmt_cost and record_stmt_cost suitable for scalar stmt
and branch stmt costing which do not need information like
a vector type or alignment.  It also fixes two mistakes where
costs for versioning tests were recorded as vector stmt rather
than scalar stmt.

This is a first patch to simplify the actual fix for PR104582.

2022-02-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104582
* tree-vectorizer.h (add_stmt_cost): New overload.
(record_stmt_cost): Likewise.
* tree-vect-loop.cc (vect_compute_single_scalar_iteration_cost):
Use add_stmt_costs.
(vect_get_known_peeling_cost): Use new overloads.
(vect_estimate_min_profitable_iters): Likewise.  Consistently
use scalar_stmt for costing versioning checks.
* tree-vect-stmts.cc (record_stmt_cost): New overload.
gcc/tree-vect-loop.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h