]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
CCP: Manually rename the virtual mem op when inserting clobbers
authorAndrew Pinski <quic_apinski@quicinc.com>
Sat, 31 May 2025 05:30:01 +0000 (22:30 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 5 Jun 2025 16:34:27 +0000 (09:34 -0700)
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 <quic_apinski@quicinc.com>
gcc/tree-ssa-ccp.cc

index 3e0c75cf2be8af0754dfe0629dd017a67786f54a..13cd81d9567271cc51a86123eb016b335e083ad4 100644 (file)
@@ -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);