Commit 986d97ed by Richard Sandiford Committed by Richard Sandiford

re PR tree-optimization/34472 (gcc.dg/struct/wo_prof_malloc_size_var.c doesn't work)

gcc/
	PR tree-optimization/34472
	* ipa-struct-reorg.c (safe_cond_expr_check): Change the DATA
	parameter to a "bool *" and set *DATA to false if there is
	an unsafe access.  Do not delete the structure here.
	(check_cond_exprs): Delete it here instead.
	(check_cond_exprs, exclude_cold_structs): Do not increase
	I when removing a structure.

From-SVN: r131798
parent fcc44808
2008-01-24 Richard Sandiford <rsandifo@nildram.co.uk>
PR tree-optimization/34472
* ipa-struct-reorg.c (safe_cond_expr_check): Change the DATA
parameter to a "bool *" and set *DATA to false if there is
an unsafe access. Do not delete the structure here.
(check_cond_exprs): Delete it here instead.
(check_cond_exprs, exclude_cold_structs): Do not increase
I when removing a structure.
2008-01-24 Uros Bizjak <ubizjak@gmail.com> 2008-01-24 Uros Bizjak <ubizjak@gmail.com>
PR target/34856 PR target/34856
......
...@@ -3074,26 +3074,24 @@ dump_accs (d_str str) ...@@ -3074,26 +3074,24 @@ dump_accs (d_str str)
} }
/* This function checks whether an access statement, pointed by SLOT, /* This function checks whether an access statement, pointed by SLOT,
is a condition we are capable to transform. If not, it removes is a condition we are capable to transform. It returns false if not,
the structure with index, represented by DATA, from the vector setting bool *DATA to false. */
of structures. */
static int static int
safe_cond_expr_check (void **slot, void *data) safe_cond_expr_check (void **slot, void *data)
{ {
struct access_site *acc = *(struct access_site **) slot; struct access_site *acc = *(struct access_site **) slot;
if (TREE_CODE (acc->stmt) == COND_EXPR) if (TREE_CODE (acc->stmt) == COND_EXPR
&& !is_safe_cond_expr (acc->stmt))
{ {
if (!is_safe_cond_expr (acc->stmt)) if (dump_file)
{ {
if (dump_file) fprintf (dump_file, "\nUnsafe conditional statement ");
{ print_generic_stmt (dump_file, acc->stmt, 0);
fprintf (dump_file, "\nUnsafe conditional statement ");
print_generic_stmt (dump_file, acc->stmt, 0);
}
remove_structure (*(unsigned *) data);
} }
*(bool *) data = false;
return 0;
} }
return 1; return 1;
} }
...@@ -3547,9 +3545,18 @@ check_cond_exprs (void) ...@@ -3547,9 +3545,18 @@ check_cond_exprs (void)
d_str str; d_str str;
unsigned i; unsigned i;
for (i = 0; VEC_iterate (structure, structures, i, str); i++) i = 0;
if (str->accs) while (VEC_iterate (structure, structures, i, str))
htab_traverse (str->accs, safe_cond_expr_check, &i); {
bool safe_p = true;
if (str->accs)
htab_traverse (str->accs, safe_cond_expr_check, &safe_p);
if (!safe_p)
remove_structure (i);
else
i++;
}
} }
/* We exclude from non-field accesses of the structure /* We exclude from non-field accesses of the structure
...@@ -3859,7 +3866,8 @@ exclude_cold_structs (void) ...@@ -3859,7 +3866,8 @@ exclude_cold_structs (void)
sum_counts (str, &hotest); sum_counts (str, &hotest);
/* Remove cold structures from structures vector. */ /* Remove cold structures from structures vector. */
for (i = 0; VEC_iterate (structure, structures, i, str); i++) i = 0;
while (VEC_iterate (structure, structures, i, str))
if (str->count * 100 < (hotest * STRUCT_REORG_COLD_STRUCT_RATIO)) if (str->count * 100 < (hotest * STRUCT_REORG_COLD_STRUCT_RATIO))
{ {
if (dump_file) if (dump_file)
...@@ -3870,6 +3878,8 @@ exclude_cold_structs (void) ...@@ -3870,6 +3878,8 @@ exclude_cold_structs (void)
} }
remove_structure (i); remove_structure (i);
} }
else
i++;
} }
/* This function decomposes original structure into substructures, /* This function decomposes original structure into substructures,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment