--- /dev/null
+// { 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;
+}
+
+
static inline tree
get_access_replacement (struct access *access)
{
- if (!access->replacement_decl)
- access->replacement_decl = create_access_replacement (access);
+ gcc_checking_assert (access->replacement_decl);
return access->replacement_decl;
}
|| ((root->grp_scalar_read || root->grp_assignment_read)
&& (root->grp_scalar_write || root->grp_assignment_write))))
{
- bool new_integer_type;
/* Always create access replacements that cover the whole access.
For integral types this means the precision has to match.
Avoid assumptions based on the integral type kind, too. */
root->expr = build_ref_for_offset (UNKNOWN_LOCATION,
root->base, root->offset,
root->type, NULL, false);
- new_integer_type = true;
- }
- else
- new_integer_type = false;
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- 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%s.\n",
- new_integer_type ? " with an integer": "");
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Changing the type of a replacement for ");
+ 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 an integer.\n");
+ }
}
root->grp_to_be_replaced = 1;
+ root->replacement_decl = create_access_replacement (root);
sth_created = true;
hole = false;
}
if (MAY_HAVE_DEBUG_STMTS)
{
root->grp_to_be_debug_replaced = 1;
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- 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");
- }
+ root->replacement_decl = create_access_replacement (root);
}
}
static tree
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