diff options
author | Richard Biener <rguenther@suse.de> | 2023-07-04 10:46:35 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-07-04 12:32:56 +0200 |
commit | 11350734240dbaf9dfe498ad0b7759a23f101ecc (patch) | |
tree | e32ab74a733235311d6d431c92ca142754a4462f | |
parent | 6eea7eaf11e2b04670c4bb75f48600747dd76768 (diff) | |
download | gcc-11350734240dbaf9dfe498ad0b7759a23f101ecc.zip gcc-11350734240dbaf9dfe498ad0b7759a23f101ecc.tar.gz gcc-11350734240dbaf9dfe498ad0b7759a23f101ecc.tar.bz2 |
Use mark_ssa_maybe_undefs in PHI-OPT
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.
-rw-r--r-- | gcc/tree-ssa-phiopt.cc | 8 | ||||
-rw-r--r-- | gcc/tree-ssa.cc | 17 | ||||
-rw-r--r-- | 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 2fb28b4..31a7c39 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 607b37e..ebba02b 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 fa8c808..18c279f 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); |