Claw back some of the code size regression in 548.exchange2_r
authorRichard Sandiford <richard.sandiford@arm.com>
Sat, 19 Jan 2019 12:59:51 +0000 (12:59 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 19 Jan 2019 12:59:51 +0000 (12:59 +0000)
commite047844bd6af7b167eb06c570c2c79b800165bfb
tree5e8d6419785057f060ac589573af4aa2ace012dd
parentb9e25708aa6fbe8fed641882bbdde4410d7c6d61
Claw back some of the code size regression in 548.exchange2_r

This patch tries harder to detect cases in which the inner dimension
of an array access is invariant, such as:

     x(i, :) = 100

It fixes some of the code size regression in 548.exchange2_r, with
size improving by 5% compared to before the patch.  Of the two other
SPEC 2017 tests affected by loop versioning, 554.roms_r improved by a
trivial amount (0.3%) and 549.fotonik3d_r didn't change.  All three
results are with -Ofast -flto.

2019-01-19  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* gimple-loop-versioning.cc (loop_versioning::dump_inner_likelihood):
New function, split out from...
(loop_versioning::analyze_stride): ...here.
(loop_versioning::find_per_loop_multiplication): Use gassign.
(loop_versioning::analyze_term_using_scevs): Return a success code.
(loop_versioning::analyze_arbitrary_term): New function.
(loop_versioning::analyze_address_fragment): Use
analyze_arbitrary_term if all else fails.

gcc/testsuite/
* gfortran.dg/loop_versioning_1.f90: Bump the number of identified
inner strides.
* gfortran.dg/loop_versioning_9.f90: New test.
* gfortran.dg/loop_versioning_10.f90: Likewise.

From-SVN: r268093
gcc/ChangeLog
gcc/gimple-loop-versioning.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/loop_versioning_1.f90
gcc/testsuite/gfortran.dg/loop_versioning_10.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/loop_versioning_9.f90 [new file with mode: 0644]