mirror of git://gcc.gnu.org/git/gcc.git
re PR debug/51570 (FAIL: gcc.dg/guality/pr45003-[23].c)
PR debug/51570 * var-tracking.c (expand_depth): New type. (onepart_aux, expand_loc_callback_data): Change depth type to it. (loc_exp_dep_alloc): Adjust initializer. (update_depth): Use new type. Add entryvals. (vt_expand_var_loc_chain): Take note of expansions with ENTRY_VALUEs, but don't accept them right away. Run an optional second pass accepting the minimum ENTRY_VALUE count found in the first pass. (vt_expand_loc_callback, INIT_ELCD): Adjust. From-SVN: r186420
This commit is contained in:
parent
f164e49a3f
commit
6a184afa58
|
@ -1,3 +1,16 @@
|
||||||
|
2012-04-13 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
PR debug/51570
|
||||||
|
* var-tracking.c (expand_depth): New type.
|
||||||
|
(onepart_aux, expand_loc_callback_data): Change depth type to it.
|
||||||
|
(loc_exp_dep_alloc): Adjust initializer.
|
||||||
|
(update_depth): Use new type. Add entryvals.
|
||||||
|
(vt_expand_var_loc_chain): Take note of expansions with
|
||||||
|
ENTRY_VALUEs, but don't accept them right away. Run an optional
|
||||||
|
second pass accepting the minimum ENTRY_VALUE count found in the
|
||||||
|
first pass.
|
||||||
|
(vt_expand_loc_callback, INIT_ELCD): Adjust.
|
||||||
|
|
||||||
2012-04-13 Tom de Vries <tom@codesourcery.com>
|
2012-04-13 Tom de Vries <tom@codesourcery.com>
|
||||||
|
|
||||||
* tree-ssa-tail-merge.c (gsi_advance_bw_nondebug_nonlocal): Add
|
* tree-ssa-tail-merge.c (gsi_advance_bw_nondebug_nonlocal): Add
|
||||||
|
|
|
@ -320,6 +320,19 @@ typedef struct loc_exp_dep_s
|
||||||
|
|
||||||
DEF_VEC_O (loc_exp_dep);
|
DEF_VEC_O (loc_exp_dep);
|
||||||
|
|
||||||
|
/* This data structure holds information about the depth of a variable
|
||||||
|
expansion. */
|
||||||
|
typedef struct expand_depth_struct
|
||||||
|
{
|
||||||
|
/* This measures the complexity of the expanded expression. It
|
||||||
|
grows by one for each level of expansion that adds more than one
|
||||||
|
operand. */
|
||||||
|
int complexity;
|
||||||
|
/* This counts the number of ENTRY_VALUE expressions in an
|
||||||
|
expansion. We want to minimize their use. */
|
||||||
|
int entryvals;
|
||||||
|
} expand_depth;
|
||||||
|
|
||||||
/* This data structure is allocated for one-part variables at the time
|
/* This data structure is allocated for one-part variables at the time
|
||||||
of emitting notes. */
|
of emitting notes. */
|
||||||
struct onepart_aux
|
struct onepart_aux
|
||||||
|
@ -338,7 +351,7 @@ struct onepart_aux
|
||||||
a change notification from any of its active dependencies. */
|
a change notification from any of its active dependencies. */
|
||||||
rtx from;
|
rtx from;
|
||||||
/* The depth of the cur_loc expression. */
|
/* The depth of the cur_loc expression. */
|
||||||
int depth;
|
expand_depth depth;
|
||||||
/* Dependencies actively used when expand FROM into cur_loc. */
|
/* Dependencies actively used when expand FROM into cur_loc. */
|
||||||
VEC (loc_exp_dep, none) deps;
|
VEC (loc_exp_dep, none) deps;
|
||||||
};
|
};
|
||||||
|
@ -7491,7 +7504,7 @@ struct expand_loc_callback_data
|
||||||
|
|
||||||
/* The maximum depth among the sub-expressions under expansion.
|
/* The maximum depth among the sub-expressions under expansion.
|
||||||
Zero indicates no expansion so far. */
|
Zero indicates no expansion so far. */
|
||||||
int depth;
|
expand_depth depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Allocate the one-part auxiliary data structure for VAR, with enough
|
/* Allocate the one-part auxiliary data structure for VAR, with enough
|
||||||
|
@ -7536,7 +7549,8 @@ loc_exp_dep_alloc (variable var, int count)
|
||||||
VAR_LOC_1PAUX (var) = XNEWVAR (struct onepart_aux, allocsize);
|
VAR_LOC_1PAUX (var) = XNEWVAR (struct onepart_aux, allocsize);
|
||||||
*VAR_LOC_DEP_LSTP (var) = NULL;
|
*VAR_LOC_DEP_LSTP (var) = NULL;
|
||||||
VAR_LOC_FROM (var) = NULL;
|
VAR_LOC_FROM (var) = NULL;
|
||||||
VAR_LOC_DEPTH (var) = 0;
|
VAR_LOC_DEPTH (var).complexity = 0;
|
||||||
|
VAR_LOC_DEPTH (var).entryvals = 0;
|
||||||
}
|
}
|
||||||
VEC_embedded_init (loc_exp_dep, VAR_LOC_DEP_VEC (var), count);
|
VEC_embedded_init (loc_exp_dep, VAR_LOC_DEP_VEC (var), count);
|
||||||
}
|
}
|
||||||
|
@ -7691,21 +7705,26 @@ static rtx vt_expand_loc_callback (rtx x, bitmap regs,
|
||||||
/* Return the combined depth, when one sub-expression evaluated to
|
/* Return the combined depth, when one sub-expression evaluated to
|
||||||
BEST_DEPTH and the previous known depth was SAVED_DEPTH. */
|
BEST_DEPTH and the previous known depth was SAVED_DEPTH. */
|
||||||
|
|
||||||
static inline int
|
static inline expand_depth
|
||||||
update_depth (int saved_depth, int best_depth)
|
update_depth (expand_depth saved_depth, expand_depth best_depth)
|
||||||
{
|
{
|
||||||
/* If we didn't find anything, stick with what we had. */
|
/* If we didn't find anything, stick with what we had. */
|
||||||
if (!best_depth)
|
if (!best_depth.complexity)
|
||||||
return saved_depth;
|
return saved_depth;
|
||||||
|
|
||||||
/* If we found hadn't found anything, use the depth of the current
|
/* If we found hadn't found anything, use the depth of the current
|
||||||
expression. Do NOT add one extra level, we want to compute the
|
expression. Do NOT add one extra level, we want to compute the
|
||||||
maximum depth among sub-expressions. We'll increment it later,
|
maximum depth among sub-expressions. We'll increment it later,
|
||||||
if appropriate. */
|
if appropriate. */
|
||||||
if (!saved_depth)
|
if (!saved_depth.complexity)
|
||||||
return best_depth;
|
return best_depth;
|
||||||
|
|
||||||
if (saved_depth < best_depth)
|
/* Combine the entryval count so that regardless of which one we
|
||||||
|
return, the entryval count is accurate. */
|
||||||
|
best_depth.entryvals = saved_depth.entryvals
|
||||||
|
= best_depth.entryvals + saved_depth.entryvals;
|
||||||
|
|
||||||
|
if (saved_depth.complexity < best_depth.complexity)
|
||||||
return best_depth;
|
return best_depth;
|
||||||
else
|
else
|
||||||
return saved_depth;
|
return saved_depth;
|
||||||
|
@ -7727,12 +7746,14 @@ vt_expand_var_loc_chain (variable var, bitmap regs, void *data, bool *pendrecp)
|
||||||
bool pending_recursion;
|
bool pending_recursion;
|
||||||
rtx loc_from = NULL;
|
rtx loc_from = NULL;
|
||||||
struct elt_loc_list *cloc = NULL;
|
struct elt_loc_list *cloc = NULL;
|
||||||
int depth = 0, saved_depth = elcd->depth;
|
expand_depth depth = { 0, 0 }, saved_depth = elcd->depth;
|
||||||
|
int wanted_entryvals, found_entryvals = 0;
|
||||||
|
|
||||||
/* Clear all backlinks pointing at this, so that we're not notified
|
/* Clear all backlinks pointing at this, so that we're not notified
|
||||||
while we're active. */
|
while we're active. */
|
||||||
loc_exp_dep_clear (var);
|
loc_exp_dep_clear (var);
|
||||||
|
|
||||||
|
retry:
|
||||||
if (var->onepart == ONEPART_VALUE)
|
if (var->onepart == ONEPART_VALUE)
|
||||||
{
|
{
|
||||||
cselib_val *val = CSELIB_VAL_PTR (dv_as_value (var->dv));
|
cselib_val *val = CSELIB_VAL_PTR (dv_as_value (var->dv));
|
||||||
|
@ -7745,13 +7766,15 @@ vt_expand_var_loc_chain (variable var, bitmap regs, void *data, bool *pendrecp)
|
||||||
first_child = result_first_child = last_child
|
first_child = result_first_child = last_child
|
||||||
= VEC_length (rtx, elcd->expanding);
|
= VEC_length (rtx, elcd->expanding);
|
||||||
|
|
||||||
|
wanted_entryvals = found_entryvals;
|
||||||
|
|
||||||
/* Attempt to expand each available location in turn. */
|
/* Attempt to expand each available location in turn. */
|
||||||
for (next = loc = var->n_var_parts ? var->var_part[0].loc_chain : NULL;
|
for (next = loc = var->n_var_parts ? var->var_part[0].loc_chain : NULL;
|
||||||
loc || cloc; loc = next)
|
loc || cloc; loc = next)
|
||||||
{
|
{
|
||||||
result_first_child = last_child;
|
result_first_child = last_child;
|
||||||
|
|
||||||
if (!loc || (GET_CODE (loc->loc) == ENTRY_VALUE && cloc))
|
if (!loc)
|
||||||
{
|
{
|
||||||
loc_from = cloc->loc;
|
loc_from = cloc->loc;
|
||||||
next = loc;
|
next = loc;
|
||||||
|
@ -7767,7 +7790,7 @@ vt_expand_var_loc_chain (variable var, bitmap regs, void *data, bool *pendrecp)
|
||||||
|
|
||||||
gcc_checking_assert (!unsuitable_loc (loc_from));
|
gcc_checking_assert (!unsuitable_loc (loc_from));
|
||||||
|
|
||||||
elcd->depth = 0;
|
elcd->depth.complexity = elcd->depth.entryvals = 0;
|
||||||
result = cselib_expand_value_rtx_cb (loc_from, regs, EXPR_DEPTH,
|
result = cselib_expand_value_rtx_cb (loc_from, regs, EXPR_DEPTH,
|
||||||
vt_expand_loc_callback, data);
|
vt_expand_loc_callback, data);
|
||||||
last_child = VEC_length (rtx, elcd->expanding);
|
last_child = VEC_length (rtx, elcd->expanding);
|
||||||
|
@ -7776,23 +7799,48 @@ vt_expand_var_loc_chain (variable var, bitmap regs, void *data, bool *pendrecp)
|
||||||
{
|
{
|
||||||
depth = elcd->depth;
|
depth = elcd->depth;
|
||||||
|
|
||||||
gcc_checking_assert (depth || result_first_child == last_child);
|
gcc_checking_assert (depth.complexity
|
||||||
|
|| result_first_child == last_child);
|
||||||
|
|
||||||
if (last_child - result_first_child != 1)
|
if (last_child - result_first_child != 1)
|
||||||
depth++;
|
{
|
||||||
|
if (!depth.complexity && GET_CODE (result) == ENTRY_VALUE)
|
||||||
|
depth.entryvals++;
|
||||||
|
depth.complexity++;
|
||||||
|
}
|
||||||
|
|
||||||
if (depth <= EXPR_USE_DEPTH)
|
if (depth.complexity <= EXPR_USE_DEPTH)
|
||||||
break;
|
{
|
||||||
|
if (depth.entryvals <= wanted_entryvals)
|
||||||
|
break;
|
||||||
|
else if (!found_entryvals || depth.entryvals < found_entryvals)
|
||||||
|
found_entryvals = depth.entryvals;
|
||||||
|
}
|
||||||
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set it up in case we leave the loop. */
|
/* Set it up in case we leave the loop. */
|
||||||
depth = 0;
|
depth.complexity = depth.entryvals = 0;
|
||||||
loc_from = NULL;
|
loc_from = NULL;
|
||||||
result_first_child = first_child;
|
result_first_child = first_child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!loc_from && wanted_entryvals < found_entryvals)
|
||||||
|
{
|
||||||
|
/* We found entries with ENTRY_VALUEs and skipped them. Since
|
||||||
|
we could not find any expansions without ENTRY_VALUEs, but we
|
||||||
|
found at least one with them, go back and get an entry with
|
||||||
|
the minimum number ENTRY_VALUE count that we found. We could
|
||||||
|
avoid looping, but since each sub-loc is already resolved,
|
||||||
|
the re-expansion should be trivial. ??? Should we record all
|
||||||
|
attempted locs as dependencies, so that we retry the
|
||||||
|
expansion should any of them change, in the hope it can give
|
||||||
|
us a new entry without an ENTRY_VALUE? */
|
||||||
|
VEC_truncate (rtx, elcd->expanding, first_child);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
/* Register all encountered dependencies as active. */
|
/* Register all encountered dependencies as active. */
|
||||||
pending_recursion = loc_exp_dep_set
|
pending_recursion = loc_exp_dep_set
|
||||||
(var, result, VEC_address (rtx, elcd->expanding) + result_first_child,
|
(var, result, VEC_address (rtx, elcd->expanding) + result_first_child,
|
||||||
|
@ -7805,7 +7853,7 @@ vt_expand_var_loc_chain (variable var, bitmap regs, void *data, bool *pendrecp)
|
||||||
VAR_LOC_FROM (var) = loc_from;
|
VAR_LOC_FROM (var) = loc_from;
|
||||||
VAR_LOC_DEPTH (var) = depth;
|
VAR_LOC_DEPTH (var) = depth;
|
||||||
|
|
||||||
gcc_checking_assert (!depth == !result);
|
gcc_checking_assert (!depth.complexity == !result);
|
||||||
|
|
||||||
elcd->depth = update_depth (saved_depth, depth);
|
elcd->depth = update_depth (saved_depth, depth);
|
||||||
|
|
||||||
|
@ -7893,7 +7941,7 @@ vt_expand_loc_callback (rtx x, bitmap regs,
|
||||||
gcc_checking_assert (!NO_LOC_P (x));
|
gcc_checking_assert (!NO_LOC_P (x));
|
||||||
gcc_checking_assert (var->var_part[0].cur_loc);
|
gcc_checking_assert (var->var_part[0].cur_loc);
|
||||||
gcc_checking_assert (VAR_LOC_1PAUX (var));
|
gcc_checking_assert (VAR_LOC_1PAUX (var));
|
||||||
gcc_checking_assert (VAR_LOC_1PAUX (var)->depth);
|
gcc_checking_assert (VAR_LOC_1PAUX (var)->depth.complexity);
|
||||||
|
|
||||||
elcd->depth = update_depth (elcd->depth, VAR_LOC_1PAUX (var)->depth);
|
elcd->depth = update_depth (elcd->depth, VAR_LOC_1PAUX (var)->depth);
|
||||||
|
|
||||||
|
@ -7967,7 +8015,7 @@ resolve_expansions_pending_recursion (VEC (rtx, stack) *pending)
|
||||||
(d).vars = (v); \
|
(d).vars = (v); \
|
||||||
(d).expanding = VEC_alloc (rtx, stack, 4); \
|
(d).expanding = VEC_alloc (rtx, stack, 4); \
|
||||||
(d).pending = VEC_alloc (rtx, stack, 4); \
|
(d).pending = VEC_alloc (rtx, stack, 4); \
|
||||||
(d).depth = 0; \
|
(d).depth.complexity = (d).depth.entryvals = 0; \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
/* Finalize expand_loc_callback_data D, resolved to location L. */
|
/* Finalize expand_loc_callback_data D, resolved to location L. */
|
||||||
|
|
Loading…
Reference in New Issue