* [PATCH] Use mark_ssa_maybe_undefs in PHI-OPT
@ 2023-07-04 10:34 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-07-04 10:34 UTC (permalink / raw)
To: gcc-patches
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.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
* 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 | 8 ++++++--
gcc/tree-ssa.cc | 17 -----------------
gcc/tree-ssa.h | 1 -
3 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 2fb28b4e60e..31a7c39e405 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -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.
diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
index 607b37e7cf9..ebba02b8449 100644
--- a/gcc/tree-ssa.cc
+++ b/gcc/tree-ssa.cc
@@ -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
diff --git a/gcc/tree-ssa.h b/gcc/tree-ssa.h
index fa8c8082311..18c279f29d5 100644
--- a/gcc/tree-ssa.h
+++ b/gcc/tree-ssa.h
@@ -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);
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-04 10:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 10:34 [PATCH] Use mark_ssa_maybe_undefs in PHI-OPT Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).