re PR tree-optimization/56294 (BOOT_CFLAGS='-O2 -g -fno-ipa-sra' leads to bootstrap comparison failure)

2013-02-28  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/56294
	* tree-sra.c (analyze_access_subtree): Create replacement declarations.
	Adjust dumping.
	(get_access_replacement): Do not call create_access_replacement.
	Assert a replacement exists.
	(get_repl_default_def_ssa_name): Create the replacement declaration
	itself.

testsuite/
	* g++.dg/debug/pr56294.C: New test.

From-SVN: r196340
This commit is contained in:
Martin Jambor 2013-02-28 13:43:33 +01:00 committed by Martin Jambor
parent 4f3ff9c1db
commit b48b3fc483
4 changed files with 61 additions and 25 deletions

View File

@ -1,3 +1,13 @@
2013-02-28 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/56294
* tree-sra.c (analyze_access_subtree): Create replacement declarations.
Adjust dumping.
(get_access_replacement): Do not call create_access_replacement.
Assert a replacement exists.
(get_repl_default_def_ssa_name): Create the replacement declaration
itself.
2013-02-28 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2013-02-28 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* config/arm/arm.c (arm_output_mi_thunk): Call final_start_function and * config/arm/arm.c (arm_output_mi_thunk): Call final_start_function and

View File

@ -1,3 +1,8 @@
2013-02-28 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/56294
* g++.dg/debug/pr56294.C: New test.
2013-02-28 Marcus Shawcroft <marcus.shawcroft@arm.com> 2013-02-28 Marcus Shawcroft <marcus.shawcroft@arm.com>
* g++.old-deja/g++.pt/ptrmem6.C(main): Add xfail aarch64*-*-*. * g++.old-deja/g++.pt/ptrmem6.C(main): Add xfail aarch64*-*-*.

View File

@ -0,0 +1,30 @@
// { dg-do compile }
// { dg-options "-fno-ipa-sra -fcompare-debug" }
struct comp_cost { int cost; unsigned complexity; };
struct cost_pair { struct iv_cand *cand; };
struct iv_use { unsigned n_map_members; cost_pair *cost_map; };
struct iv_cand { unsigned id; };
unsigned gu;
void
bar (comp_cost, comp_cost)
{
}
void
foo (iv_use *use, iv_cand *cand)
{
unsigned i, s = cand->id & (use->n_map_members - 1);
for (i = 0; i < s; i++)
if (use->cost_map[i].cand)
goto found;
found:
use->cost_map[i].cand = cand;
comp_cost elim_cost, express_cost, bound_cost;
bar (elim_cost, express_cost);
gu = express_cost.complexity;
}

View File

@ -2000,8 +2000,7 @@ create_access_replacement (struct access *access)
static inline tree static inline tree
get_access_replacement (struct access *access) get_access_replacement (struct access *access)
{ {
if (!access->replacement_decl) gcc_checking_assert (access->replacement_decl);
access->replacement_decl = create_access_replacement (access);
return access->replacement_decl; return access->replacement_decl;
} }
@ -2157,7 +2156,6 @@ analyze_access_subtree (struct access *root, struct access *parent,
|| ((root->grp_scalar_read || root->grp_assignment_read) || ((root->grp_scalar_read || root->grp_assignment_read)
&& (root->grp_scalar_write || root->grp_assignment_write)))) && (root->grp_scalar_write || root->grp_assignment_write))))
{ {
bool new_integer_type;
/* Always create access replacements that cover the whole access. /* Always create access replacements that cover the whole access.
For integral types this means the precision has to match. For integral types this means the precision has to match.
Avoid assumptions based on the integral type kind, too. */ Avoid assumptions based on the integral type kind, too. */
@ -2176,22 +2174,19 @@ analyze_access_subtree (struct access *root, struct access *parent,
root->expr = build_ref_for_offset (UNKNOWN_LOCATION, root->expr = build_ref_for_offset (UNKNOWN_LOCATION,
root->base, root->offset, root->base, root->offset,
root->type, NULL, false); root->type, NULL, false);
new_integer_type = true;
}
else
new_integer_type = false;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
fprintf (dump_file, "Marking "); fprintf (dump_file, "Changing the type of a replacement for ");
print_generic_expr (dump_file, root->base, 0); print_generic_expr (dump_file, root->base, 0);
fprintf (dump_file, " offset: %u, size: %u ", fprintf (dump_file, " offset: %u, size: %u ",
(unsigned) root->offset, (unsigned) root->size); (unsigned) root->offset, (unsigned) root->size);
fprintf (dump_file, " to be replaced%s.\n", fprintf (dump_file, " to an integer.\n");
new_integer_type ? " with an integer": ""); }
} }
root->grp_to_be_replaced = 1; root->grp_to_be_replaced = 1;
root->replacement_decl = create_access_replacement (root);
sth_created = true; sth_created = true;
hole = false; hole = false;
} }
@ -2209,15 +2204,7 @@ analyze_access_subtree (struct access *root, struct access *parent,
if (MAY_HAVE_DEBUG_STMTS) if (MAY_HAVE_DEBUG_STMTS)
{ {
root->grp_to_be_debug_replaced = 1; root->grp_to_be_debug_replaced = 1;
if (dump_file && (dump_flags & TDF_DETAILS)) root->replacement_decl = create_access_replacement (root);
{
fprintf (dump_file, "Marking ");
print_generic_expr (dump_file, root->base, 0);
fprintf (dump_file, " offset: %u, size: %u ",
(unsigned) root->offset, (unsigned) root->size);
fprintf (dump_file, " to be replaced with debug "
"statements.\n");
}
} }
} }
@ -2973,7 +2960,11 @@ sra_modify_constructor_assign (gimple *stmt, gimple_stmt_iterator *gsi)
static tree static tree
get_repl_default_def_ssa_name (struct access *racc) get_repl_default_def_ssa_name (struct access *racc)
{ {
return get_or_create_ssa_default_def (cfun, get_access_replacement (racc)); gcc_checking_assert (!racc->grp_to_be_replaced &&
!racc->grp_to_be_debug_replaced);
if (!racc->replacement_decl)
racc->replacement_decl = create_access_replacement (racc);
return get_or_create_ssa_default_def (cfun, racc->replacement_decl);
} }
/* Return true if REF has a COMPONENT_REF with a bit-field field declaration /* Return true if REF has a COMPONENT_REF with a bit-field field declaration