// direct dependent is exported, it may also change the computed value of NAME.
bool
-gori_compute::may_recompute_p (tree name, basic_block bb)
+gori_compute::may_recompute_p (tree name, basic_block bb, int depth)
{
tree dep1 = depend1 (name);
tree dep2 = depend2 (name);
if (is_a<gphi *> (s) || gimple_has_side_effects (s))
return false;
- // If edge is specified, check if NAME can be recalculated on that edge.
- if (bb)
- return ((is_export_p (dep1, bb))
- || (dep2 && is_export_p (dep2, bb)));
+ if (!dep2)
+ {
+ // -1 indicates a default param, convert it to the real default.
+ if (depth == -1)
+ {
+ depth = (int)param_ranger_recompute_depth;
+ gcc_checking_assert (depth >= 1);
+ }
- return (is_export_p (dep1)) || (dep2 && is_export_p (dep2));
+ bool res = (bb ? is_export_p (dep1, bb) : is_export_p (dep1));
+ if (res || depth <= 1)
+ return res;
+ // Check another level of recomputation.
+ return may_recompute_p (dep1, bb, --depth);
+ }
+ // Two dependencies terminate the depth of the search.
+ if (bb)
+ return is_export_p (dep1, bb) || is_export_p (dep2, bb);
+ else
+ return is_export_p (dep1) || is_export_p (dep2);
}
// Return TRUE if NAME can be recomputed on edge E. If any direct dependent
// is exported on edge E, it may change the computed value of NAME.
bool
-gori_compute::may_recompute_p (tree name, edge e)
+gori_compute::may_recompute_p (tree name, edge e, int depth)
{
gcc_checking_assert (e);
- return may_recompute_p (name, e->src);
+ return may_recompute_p (name, e->src, depth);
}
bool refine_using_relation (tree op1, vrange &op1_range,
tree op2, vrange &op2_range,
fur_source &src, relation_kind k);
- bool may_recompute_p (tree name, edge e);
- bool may_recompute_p (tree name, basic_block bb = NULL);
+ bool may_recompute_p (tree name, edge e, int depth = -1);
+ bool may_recompute_p (tree name, basic_block bb = NULL, int depth = -1);
bool compute_operand_range_switch (vrange &r, gswitch *s, const vrange &lhs,
tree name, fur_source &src);
bool compute_operand1_range (vrange &r, gimple_range_op_handler &handler,
Maximum depth of logical expression evaluation ranger will look through when
evaluating outgoing edge ranges.
+-param=ranger-recompute-depth=
+Common Joined UInteger Var(param_ranger_recompute_depth) Init(5) IntegerRange(1, 100) Param Optimization
+Maximum depth of instruction chains to consider for recomputation in the
+outgoing range calculator.
+
-param=relation-block-limit=
Common Joined UInteger Var(param_relation_block_limit) Init(200) IntegerRange(0, 9999) Param Optimization
Maximum number of relations the oracle will register in a basic block.