Remove create_lcssa_for_virtual_phi and uses
The following expands the comment in vect_do_peeling as to why we do not need create_lcssa_for_virtual_phi and removes that function. That's the last bit I have queued for the vectorizer virtual LCSSA cleanup. * tree-vect-loop-manip.cc (create_lcssa_for_virtual_phi): Remove. (vect_do_peeling): Do not call it, adjust comment.
This commit is contained in:
parent
7005b5e57e
commit
9b06b9d237
1 changed files with 7 additions and 88 deletions
|
@ -1332,56 +1332,6 @@ slpeel_can_duplicate_loop_p (const class loop *loop, const_edge e)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* If the loop has a virtual PHI, but exit bb doesn't, create a virtual PHI
|
||||
in the exit bb and rename all the uses after the loop. This simplifies
|
||||
the *guard[12] routines, which assume loop closed SSA form for all PHIs
|
||||
(but normally loop closed SSA form doesn't require virtual PHIs to be
|
||||
in the same form). Doing this early simplifies the checking what
|
||||
uses should be renamed.
|
||||
|
||||
If we create a new phi after the loop, return the definition that
|
||||
applies on entry to the loop, otherwise return null. */
|
||||
|
||||
static tree
|
||||
create_lcssa_for_virtual_phi (class loop *loop)
|
||||
{
|
||||
gphi_iterator gsi;
|
||||
edge exit_e = single_exit (loop);
|
||||
|
||||
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||
if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
|
||||
{
|
||||
gphi *phi = gsi.phi ();
|
||||
for (gsi = gsi_start_phis (exit_e->dest);
|
||||
!gsi_end_p (gsi); gsi_next (&gsi))
|
||||
if (virtual_operand_p (gimple_phi_result (gsi_stmt (gsi))))
|
||||
break;
|
||||
if (gsi_end_p (gsi))
|
||||
{
|
||||
tree new_vop = copy_ssa_name (PHI_RESULT (phi));
|
||||
gphi *new_phi = create_phi_node (new_vop, exit_e->dest);
|
||||
tree vop = PHI_ARG_DEF_FROM_EDGE (phi, EDGE_SUCC (loop->latch, 0));
|
||||
imm_use_iterator imm_iter;
|
||||
gimple *stmt;
|
||||
use_operand_p use_p;
|
||||
|
||||
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_vop)
|
||||
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vop);
|
||||
add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION);
|
||||
gimple_phi_set_result (new_phi, new_vop);
|
||||
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, vop)
|
||||
if (stmt != new_phi
|
||||
&& !flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
|
||||
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
|
||||
SET_USE (use_p, new_vop);
|
||||
|
||||
return PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Function vect_get_loop_location.
|
||||
|
||||
Extract the location of the loop in the source code.
|
||||
|
@ -2702,31 +2652,20 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
|
|||
pending update needs. */
|
||||
gcc_assert (!need_ssa_update_p (cfun));
|
||||
|
||||
create_lcssa_for_virtual_phi (loop);
|
||||
|
||||
/* If we're vectorizing an epilogue loop, the update_ssa above will
|
||||
have ensured that the virtual operand is in SSA form throughout the
|
||||
vectorized main loop. Normally it is possible to trace the updated
|
||||
/* If we're vectorizing an epilogue loop, we have ensured that the
|
||||
virtual operand is in SSA form throughout the vectorized main loop.
|
||||
Normally it is possible to trace the updated
|
||||
vector-stmt vdefs back to scalar-stmt vdefs and vector-stmt vuses
|
||||
back to scalar-stmt vuses, meaning that the effect of the SSA update
|
||||
remains local to the main loop. However, there are rare cases in
|
||||
which the vectorized loop has vdefs even when the original scalar
|
||||
which the vectorized loop should have vdefs even when the original scalar
|
||||
loop didn't. For example, vectorizing a load with IFN_LOAD_LANES
|
||||
introduces clobbers of the temporary vector array, which in turn
|
||||
needs new vdefs. If the scalar loop doesn't write to memory, these
|
||||
new vdefs will be the only ones in the vector loop.
|
||||
|
||||
In that case, update_ssa will have added a new virtual phi to the
|
||||
main loop, which previously didn't need one. Ensure that we (locally)
|
||||
maintain LCSSA form for the virtual operand, just as we would have
|
||||
done if the virtual phi had existed from the outset. This makes it
|
||||
easier to duplicate the scalar epilogue loop below. */
|
||||
tree vop_to_rename = NULL_TREE;
|
||||
if (loop_vec_info orig_loop_vinfo = LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo))
|
||||
{
|
||||
class loop *orig_loop = LOOP_VINFO_LOOP (orig_loop_vinfo);
|
||||
vop_to_rename = create_lcssa_for_virtual_phi (orig_loop);
|
||||
}
|
||||
We are currently defering updating virtual SSA form and creating
|
||||
of a virtual PHI for this case so we do not have to make sure the
|
||||
newly introduced virtual def is in LCSSA form. */
|
||||
|
||||
if (MAY_HAVE_DEBUG_BIND_STMTS)
|
||||
{
|
||||
|
@ -2947,26 +2886,6 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
|
|||
as the transformations mentioned above make less or no sense when not
|
||||
vectorizing. */
|
||||
epilog = vect_epilogues ? get_loop_copy (loop) : scalar_loop;
|
||||
if (vop_to_rename)
|
||||
{
|
||||
/* Vectorizing the main loop can sometimes introduce a vdef to
|
||||
a loop that previously didn't have one; see the comment above
|
||||
the definition of VOP_TO_RENAME for details. The definition
|
||||
D that holds on E will then be different from the definition
|
||||
VOP_TO_RENAME that holds during SCALAR_LOOP, so we need to
|
||||
rename VOP_TO_RENAME to D when copying the loop.
|
||||
|
||||
The virtual operand is in LCSSA form for the main loop,
|
||||
and no stmt between the main loop and E needs a vdef,
|
||||
so we know that D is provided by a phi rather than by a
|
||||
vdef on a normal gimple stmt. */
|
||||
basic_block vdef_bb = e->src;
|
||||
gphi *vphi;
|
||||
while (!(vphi = get_virtual_phi (vdef_bb)))
|
||||
vdef_bb = get_immediate_dominator (CDI_DOMINATORS, vdef_bb);
|
||||
gcc_assert (vop_to_rename != gimple_phi_result (vphi));
|
||||
set_current_def (vop_to_rename, gimple_phi_result (vphi));
|
||||
}
|
||||
epilog = slpeel_tree_duplicate_loop_to_edge_cfg (loop, epilog, e);
|
||||
if (!epilog)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue