tree-optimization/104912 - ensure cost model is checked first
authorRichard Biener <rguenther@suse.de>
Mon, 21 Mar 2022 13:08:25 +0000 (14:08 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 20 Apr 2022 11:28:08 +0000 (13:28 +0200)
commit4d4eaa77a7d27bf7b220c3be79615410c873fcf1
tree66cc413d550bfbf39a90a5847e885fb77ae5eb8a
parent36f1de95a61132f63c0c07ef154abd9f435721ac
tree-optimization/104912 - ensure cost model is checked first

The following makes sure that when we build the versioning condition
for vectorization including the cost model check, we check for the
cost model and branch over other versioning checks.  That is what
the cost modeling assumes, since the cost model check is the only
one accounted for in the scalar outside cost.  Currently we emit
all checks as straight-line code combined with bitwise ops which
can result in surprising ordering of checks in the final assembly.

Since loop_version accepts only a single versioning condition
the splitting is done after the fact.

The result is a 1.5% speedup of 416.gamess on x86_64 when compiling
with -Ofast and tuning for generic or skylake.  That's not enough
to recover from the slowdown when vectorizing but it now cuts off
the expensive alias versioning test.

2022-03-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104912
* tree-vect-loop-manip.cc (vect_loop_versioning): Split
the cost model check to a separate BB to make sure it is
checked first and not combined with other version checks.
gcc/tree-vect-loop-manip.cc