loops: Invoke lim after successful loop interchange
authorMartin Jambor <mjambor@suse.cz>
Fri, 13 Nov 2020 14:35:18 +0000 (15:35 +0100)
committerMartin Jambor <mjambor@suse.cz>
Fri, 13 Nov 2020 14:35:18 +0000 (15:35 +0100)
commitac91af71c93462cbc701bbd104fa21894bb15e86
treef627c99eee6a069a28488e7f4e33e08fdf7fe14f
parent4d6b8d4213376e8a2405782c7e360b03d4a2b04a
loops: Invoke lim after successful loop interchange

This patch makes the entry point to loop invariant motion public, so
that it can be called after loop interchange when that pass has
swapped loops.  This avoids the non-LTO -Ofast run-time regressions of
410.bwaves and 503.bwaves_r (which are 19% and 15% faster than current
master on an AMD zen2 machine) while not introducing a full LIM pass
into the pass pipeline.

The patch also adds a parameter which allows not to perform any store
motion so that it is not done after an interchange.

gcc/ChangeLog:

2020-11-12  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/94406
* tree-ssa-loop-im.c (tree_ssa_lim): Renamed to
loop_invariant_motion_in_fun, added a parameter to control store
motion.
(pass_lim::execute): Adjust call to tree_ssa_lim, now
loop_invariant_motion_in_fun.
* tree-ssa-loop-manip.h (loop_invariant_motion_in_fun): Declare.
* gimple-loop-interchange.cc (pass_linterchange::execute): Call
loop_invariant_motion_in_fun if any interchange has been done.
gcc/gimple-loop-interchange.cc
gcc/tree-ssa-loop-im.c
gcc/tree-ssa-loop-manip.h