diff options
author | Richard Biener <rguenther@suse.de> | 2022-06-21 16:17:58 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-07-04 10:36:09 +0200 |
commit | d2a898666609452ef79a14feae1cadc3538e4b45 (patch) | |
tree | 38cd98b68a3bbdc0ed71b6533be8bac5a7666af2 /gcc/tree-ssa-loop-manip.cc | |
parent | 8c6bef0a33e32e6a95dca7d50cd5be37e7262775 (diff) | |
download | gcc-d2a898666609452ef79a14feae1cadc3538e4b45.zip gcc-d2a898666609452ef79a14feae1cadc3538e4b45.tar.gz gcc-d2a898666609452ef79a14feae1cadc3538e4b45.tar.bz2 |
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.
Diffstat (limited to 'gcc/tree-ssa-loop-manip.cc')
-rw-r--r-- | gcc/tree-ssa-loop-manip.cc | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc index 5d43563..623d03b 100644 --- a/gcc/tree-ssa-loop-manip.cc +++ b/gcc/tree-ssa-loop-manip.cc @@ -625,7 +625,7 @@ find_uses_to_rename_in_loop (class loop *loop, bitmap *use_blocks, UPDATE_FLAG is used in the call to update_ssa. See TODO_update_ssa* for documentation. */ -void +static void rewrite_into_loop_closed_ssa_1 (bitmap changed_bbs, unsigned update_flag, int use_flags, class loop *loop) { @@ -686,24 +686,16 @@ rewrite_into_loop_closed_ssa_1 (bitmap changed_bbs, unsigned update_flag, free (use_blocks); } -/* Rewrites the non-virtual defs and uses into a loop closed ssa form. If - CHANGED_BBS is not NULL, we look for uses outside loops only in the basic +/* Rewrites the defs and uses into a loop closed ssa form. + If CHANGED_BBS is not NULL, we look for uses outside loops only in the basic blocks in this set. UPDATE_FLAG is used in the call to update_ssa. See TODO_update_ssa* for documentation. */ void rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag) { - rewrite_into_loop_closed_ssa_1 (changed_bbs, update_flag, SSA_OP_USE, NULL); -} - -/* Rewrites virtual defs and uses with def in LOOP into loop closed ssa - form. */ - -void -rewrite_virtuals_into_loop_closed_ssa (class loop *loop) -{ - rewrite_into_loop_closed_ssa_1 (NULL, 0, SSA_OP_VIRTUAL_USES, loop); + rewrite_into_loop_closed_ssa_1 (changed_bbs, update_flag, + SSA_OP_ALL_USES, NULL); } /* Check invariants of the loop closed ssa form for the def in DEF_BB. */ @@ -736,8 +728,7 @@ check_loop_closed_ssa_bb (basic_block bb) { gphi *phi = bsi.phi (); - if (!virtual_operand_p (PHI_RESULT (phi))) - check_loop_closed_ssa_def (bb, PHI_RESULT (phi)); + check_loop_closed_ssa_def (bb, PHI_RESULT (phi)); } for (gimple_stmt_iterator bsi = gsi_start_nondebug_bb (bb); !gsi_end_p (bsi); @@ -747,7 +738,7 @@ check_loop_closed_ssa_bb (basic_block bb) tree var; gimple *stmt = gsi_stmt (bsi); - FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF) + FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_DEFS) check_loop_closed_ssa_def (bb, var); } } |