On Sat, May 31, 2025 at 11:07 AM Andrew Pinski <quic_apin...@quicinc.com> wrote: > > Right now the only place where CCP needs to have the virtual op renamed is > after inserting clobbers which come right before __builtin_stack_restore. > So let's manually do the correct thing so we can remove the TODO_update_ssa > todo.
OK. Thanks, Richard. > gcc/ChangeLog: > > * tree-ssa-ccp.cc (insert_clobber_before_stack_restore): Update the > virtual > op on the inserted clobber and the stack restore function. > (do_ssa_ccp): Don't add TODO_update_ssa to the todo. > > Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com> > --- > gcc/tree-ssa-ccp.cc | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc > index 8d2cbb384c4..6022ea446a4 100644 > --- a/gcc/tree-ssa-ccp.cc > +++ b/gcc/tree-ssa-ccp.cc > @@ -2567,7 +2567,12 @@ insert_clobber_before_stack_restore (tree saved_val, > tree var, > { > clobber = build_clobber (TREE_TYPE (var), CLOBBER_STORAGE_END); > clobber_stmt = gimple_build_assign (var, clobber); > - > + /* Manually update the vdef/vuse here. */ > + gimple_set_vuse (clobber_stmt, gimple_vuse (stmt)); > + gimple_set_vdef (clobber_stmt, make_ssa_name (gimple_vop (cfun))); > + gimple_set_vuse (stmt, gimple_vdef (clobber_stmt)); > + SSA_NAME_DEF_STMT (gimple_vdef (clobber_stmt)) = clobber_stmt; > + update_stmt (stmt); > i = gsi_for_stmt (stmt); > gsi_insert_before (&i, clobber_stmt, GSI_SAME_STMT); > } > @@ -3020,7 +3025,7 @@ do_ssa_ccp (bool nonzero_p) > ccp_propagate.ssa_propagate (); > if (ccp_finalize (nonzero_p || flag_ipa_bit_cp)) > { > - todo = (TODO_cleanup_cfg | TODO_update_ssa); > + todo = TODO_cleanup_cfg; > > /* ccp_finalize does not preserve loop-closed ssa. */ > loops_state_clear (LOOP_CLOSED_SSA); > -- > 2.43.0 >