aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/gimple-predicate-analysis.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index 5dade45..f81af25 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -934,23 +934,23 @@ simple_control_dep_chain (vec<edge>& chain, basic_block from, basic_block to)
}
/* Perform a DFS walk on predecessor edges to mark the region denoted
- by the EXIT edge and DOM which dominates EXIT->src, including DOM.
+ by the EXIT_SRC block and DOM which dominates EXIT_SRC, including DOM.
Blocks in the region are marked with FLAG and added to BBS. BBS is
filled up to its capacity only after which the walk is terminated
and false is returned. If the whole region was marked, true is returned. */
static bool
-dfs_mark_dominating_region (edge exit, basic_block dom, int flag,
+dfs_mark_dominating_region (basic_block exit_src, basic_block dom, int flag,
vec<basic_block> &bbs)
{
- if (exit->src == dom || exit->src->flags & flag)
+ if (exit_src == dom || exit_src->flags & flag)
return true;
if (!bbs.space (1))
return false;
- bbs.quick_push (exit->src);
- exit->src->flags |= flag;
+ bbs.quick_push (exit_src);
+ exit_src->flags |= flag;
auto_vec<edge_iterator, 20> stack (bbs.allocated () - bbs.length () + 1);
- stack.quick_push (ei_start (exit->src->preds));
+ stack.quick_push (ei_start (exit_src->preds));
while (!stack.is_empty ())
{
/* Look at the edge on the top of the stack. */
@@ -1960,6 +1960,10 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb,
}
while (1);
+ auto_bb_flag in_region (cfun);
+ auto_vec<basic_block, 20> region (MIN (n_basic_blocks_for_fn (cfun),
+ param_uninit_control_dep_attempts));
+
/* Set DEP_CHAINS to the set of edges between CD_ROOT and USE_BB.
Each DEP_CHAINS element is a series of edges whose conditions
are logical conjunctions. Together, the DEP_CHAINS vector is
@@ -1967,7 +1971,9 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb,
unsigned num_chains = 0;
auto_vec<edge> dep_chains[MAX_NUM_CHAINS];
- if (!compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains))
+ if (!dfs_mark_dominating_region (use_bb, cd_root, in_region, region)
+ || !compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains,
+ in_region))
{
/* If the info in dep_chains is not complete we need to use a
conservative approximation for the use predicate. */
@@ -1979,6 +1985,10 @@ uninit_analysis::init_use_preds (predicate &use_preds, basic_block def_bb,
simple_control_dep_chain (dep_chains[0], cd_root, use_bb);
}
+ /* Unmark the region. */
+ for (auto bb : region)
+ bb->flags &= ~in_region;
+
/* From the set of edges computed above initialize *THIS as the OR
condition under which the definition in DEF_BB is used in USE_BB.
Each OR subexpression is represented by one element of DEP_CHAINS,
@@ -2061,7 +2071,8 @@ uninit_analysis::init_from_phi_def (gphi *phi)
}
}
for (unsigned i = 0; i < nedges; i++)
- if (!dfs_mark_dominating_region (def_edges[i], cd_root, in_region, region))
+ if (!dfs_mark_dominating_region (def_edges[i]->src, cd_root,
+ in_region, region))
break;
unsigned num_chains = 0;