Put virtual operands into loop-closed SSA
authorRichard Biener <rguenther@suse.de>
Tue, 21 Jun 2022 14:17:58 +0000 (16:17 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 4 Jul 2022 08:36:09 +0000 (10:36 +0200)
commitd2a898666609452ef79a14feae1cadc3538e4b45
tree38cd98b68a3bbdc0ed71b6533be8bac5a7666af2
parent8c6bef0a33e32e6a95dca7d50cd5be37e7262775
Put virtual operands into loop-closed SSA

When attempting to manually update SSA form after high-level loop
transforms such as loop versioning it is helpful when the loop-closed
SSA form includes virtual operands.  While we have the special
rewrite_virtuals_into_loop_closed_ssa function that doesn't
presently scale, invoking update_ssa by itself.  So the following
makes the regular loop-closed SSA form also cover virtual operands.
For users of loop_version this allows to use cheaper
TODO_update_ssa_no_phi, skipping dominance frontier compute
(for the whole function) and iterated dominance frontiers for each
copied def.

* tree-ssa-loop-manip.h
(rewrite_virtuals_into_loop_closed_ssa): Remove.
(rewrite_into_loop_closed_ssa_1): Likewise.
* tree-ssa-loop-manip.cc (rewrite_into_loop_closed_ssa_1):
Make static.
(rewrite_into_loop_closed_ssa): Remove loop overload,
always rewrite virtuals into LC SSA.
(check_loop_closed_ssa_bb): Also check virtuals.
* tree-ssa-dce.cc (remove_dead_phis): Preserve virtual
LC PHIs when in LC SSA.
* gimple-loop-jam.cc (fuse_loops): Do not rewrite into
loop-closed SSA here, but ...
(tree_loop_unroll_and_jam): ... here once.
* tree-if-conv.cc (version_loop_for_if_conversion): Use
the cheaper TODO_update_ssa_no_phi.
* tree-loop-distribution.cc (version_loop_by_alias_check):
Likewise.
* tree-ssa-loop-unswitch.cc (tree_unswitch_single_loop):
Likewise.
* tree-vect-loop-manip.cc (vect_loop_versioning): Likewise.
(tree_unswitch_outer_loop): Do not rewrite virtuals into
LC ssa.
* tree-parloops.cc (transform_to_exit_first_loop_alt):
Likewise.
(pass_parallelize_loops::execute): After finishing rewrite
into LC SSA again because we do not maintain it properly.
gcc/gimple-loop-jam.cc
gcc/tree-if-conv.cc
gcc/tree-loop-distribution.cc
gcc/tree-parloops.cc
gcc/tree-ssa-dce.cc
gcc/tree-ssa-loop-manip.cc
gcc/tree-ssa-loop-manip.h
gcc/tree-ssa-loop-unswitch.cc
gcc/tree-vect-loop-manip.cc