diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2021-09-22 16:58:22 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2021-09-23 12:56:43 -0400 |
commit | 053e1d642104d19d5f9e5fb08a9e7354a0db28f5 (patch) | |
tree | 0e842f9e1c0fdd1788cb7465c2ac4f14b397b519 /gcc/vr-values.c | |
parent | 1b07d9dce6c51c98d011236c3d4cd84a2ed59ba2 (diff) | |
download | gcc-053e1d642104d19d5f9e5fb08a9e7354a0db28f5.zip gcc-053e1d642104d19d5f9e5fb08a9e7354a0db28f5.tar.gz gcc-053e1d642104d19d5f9e5fb08a9e7354a0db28f5.tar.bz2 |
Create a ranger-local flag for non-executable edges.
Instead of repurposing EDGE_EXECUTABLE, ranger creates a local flag and
ultizes it throughout.
* gimple-range-cache.cc (ranger_cache::ranger_cache): Take
non-executable_edge flag as parameter.
* gimple-range-cache.h (ranger_cache): Adjust prototype.
* gimple-range-gori.cc (gori_compute::gori_compute): Take
non-executable_edge flag as parameter.
(gori_compute::outgoing_edge_range_p): Check new flag.
* gimple-range-gori.h (gori_compute): Adjust prototype.
* gimple-range.cc (gimple_ranger::gimple_ranger): Create new flag.
(gimple_ranger::range_on_edge): Check new flag.
* gimple-range.h (gimple_ranger::non_executable_edge_flag): New.
* gimple-ssa-evrp.c (rvrp_folder): Pass ranger flag to simplifer.
(hybrid_folder::hybrid_folder): Set ranger non-executable flag value.
(hybrid_folder::fold_stmt): Set flag value in the simplifer.
* vr-values.c (simplify_using_ranges::set_and_propagate_unexecutable):
Use not_executable flag if provided inmstead of EDGE_EXECUTABLE.
(simplify_using_ranges::simplify_switch_using_ranges): Clear
EDGE_EXECUTABLE like it originally did.
(simplify_using_ranges::cleanup_edges_and_switches): Clear any
NON_EXECUTABLE flags.
(simplify_using_ranges::simplify_using_ranges): Adjust.
* vr-values.h (class simplify_using_ranges): Adjust.
(simplify_using_ranges::set_range_query): Add non-executable flag param.
Diffstat (limited to 'gcc/vr-values.c')
-rw-r--r-- | gcc/vr-values.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 3b8d067..9bf58f4 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -3460,19 +3460,21 @@ range_fits_type_p (const value_range *vr, void simplify_using_ranges::set_and_propagate_unexecutable (edge e) { - // If EXECUUTABLE is already clear, we're done. - if ((e->flags & EDGE_EXECUTABLE) == 0) + // If not_executable is already set, we're done. + // This works in the absence of a flag as well. + if ((e->flags & m_not_executable_flag) == m_not_executable_flag) return; - e->flags &= ~EDGE_EXECUTABLE; + e->flags |= m_not_executable_flag; + m_flag_set_edges.safe_push (e); // Check if the destination block needs to propagate the property. basic_block bb = e->dest; - // If any entry edge is marked EXECUTABLE, we are done. + // If any incoming edge is executable, we are done. edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) - if (e->flags & EDGE_EXECUTABLE) + if ((e->flags & m_not_executable_flag) == 0) return; // This block is also unexecutable, propagate to all exit edges as well. @@ -3805,6 +3807,7 @@ simplify_using_ranges::simplify_switch_using_ranges (gswitch *stmt) } to_remove_edges.safe_push (e); set_and_propagate_unexecutable (e); + e->flags &= ~EDGE_EXECUTABLE; e->flags |= EDGE_IGNORE; } @@ -3822,6 +3825,12 @@ simplify_using_ranges::cleanup_edges_and_switches (void) edge e; switch_update *su; + /* Clear any edges marked as not executable. */ + if (m_not_executable_flag) + { + FOR_EACH_VEC_ELT (m_flag_set_edges, i, e) + e->flags &= ~m_not_executable_flag; + } /* Remove dead edges from SWITCH_EXPR optimization. This leaves the CFG in a broken state and requires a cfg_cleanup run. */ FOR_EACH_VEC_ELT (to_remove_edges, i, e) @@ -4124,11 +4133,14 @@ simplify_using_ranges::two_valued_val_range_p (tree var, tree *a, tree *b, return false; } -simplify_using_ranges::simplify_using_ranges (range_query *query) +simplify_using_ranges::simplify_using_ranges (range_query *query, + int not_executable_flag) : query (query) { to_remove_edges = vNULL; to_update_switch_stmts = vNULL; + m_not_executable_flag = not_executable_flag; + m_flag_set_edges = vNULL; } simplify_using_ranges::~simplify_using_ranges () |