]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use mark_ssa_maybe_undefs in PHI-OPT
authorRichard Biener <rguenther@suse.de>
Tue, 4 Jul 2023 08:46:35 +0000 (10:46 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 4 Jul 2023 10:32:56 +0000 (12:32 +0200)
The following removes gimple_uses_undefined_value_p and instead
uses the conservative mark_ssa_maybe_undefs in PHI-OPT, the last
user of the other API.

* tree-ssa-phiopt.cc (pass_phiopt::execute): Mark SSA undefs.
(empty_bb_or_one_feeding_into_p): Check for them.
* tree-ssa.h (gimple_uses_undefined_value_p): Remove.
* tree-ssa.cc (gimple_uses_undefined_value_p): Likewise.

gcc/tree-ssa-phiopt.cc
gcc/tree-ssa.cc
gcc/tree-ssa.h

index 2fb28b4e60ed53c77cececa7ee619d93b0083b91..31a7c39e4052b5e9a60875318f881fd576ad3adc 100644 (file)
@@ -630,8 +630,11 @@ empty_bb_or_one_feeding_into_p (basic_block bb,
       || gimple_has_side_effects (stmt_to_move))
     return false;
 
-  if (gimple_uses_undefined_value_p (stmt_to_move))
-    return false;
+  ssa_op_iter it;
+  tree use;
+  FOR_EACH_SSA_TREE_OPERAND (use, stmt_to_move, it, SSA_OP_USE)
+    if (ssa_name_maybe_undef_p (use))
+      return false;
 
   /* Allow assignments but allow some builtin/internal calls.
      As const calls don't match any of the above, yet they could
@@ -3967,6 +3970,7 @@ pass_phiopt::execute (function *)
   bool cfgchanged = false;
 
   calculate_dominance_info (CDI_DOMINATORS);
+  mark_ssa_maybe_undefs ();
 
   /* Search every basic block for COND_EXPR we may be able to optimize.
 
index 607b37e7cf9a798592bc2aef6a69275de9c5d963..ebba02b844969f0b86b84f334aac6ffcc4312138 100644 (file)
@@ -1377,23 +1377,6 @@ ssa_undefined_value_p (tree t, bool partial)
 }
 
 
-/* Return TRUE iff STMT, a gimple statement, references an undefined
-   SSA name.  */
-
-bool
-gimple_uses_undefined_value_p (gimple *stmt)
-{
-  ssa_op_iter iter;
-  tree op;
-
-  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
-    if (ssa_undefined_value_p (op))
-      return true;
-
-  return false;
-}
-
-
 /* Return TRUE iff there are any non-PHI uses of VAR that dominate the
    end of BB.  If we return TRUE and BB is a loop header, then VAR we
    be assumed to be defined within the loop, even if it is marked as
index fa8c8082311df1893bdb406d1eb8f8cdba8ea09f..18c279f29d5e65d6e7d6e5769fe953e124f0548d 100644 (file)
@@ -54,7 +54,6 @@ extern tree find_released_ssa_name (tree *, int *, void *);
 
 extern bool ssa_defined_default_def_p (tree t);
 extern bool ssa_undefined_value_p (tree, bool = true);
-extern bool gimple_uses_undefined_value_p (gimple *);
 
 
 bool ssa_name_any_use_dominates_bb_p (tree var, basic_block bb);