From: Andrew Pinski Date: Sat, 31 May 2025 05:30:01 +0000 (-0700) Subject: CCP: Manually rename the virtual mem op when inserting clobbers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0be0298a9553c13af642f45628a15d833473657;p=thirdparty%2Fgcc.git CCP: Manually rename the virtual mem op when inserting clobbers 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. 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 --- diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc index 3e0c75cf2be..13cd81d9567 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);