/* Predictive commoning.
- Copyright (C) 2005, 2007, 2008, 2009, 2010
+ Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
gcc_assert (dominated_by_p (CDI_DOMINATORS, ba, bp));
bp = ba;
- if (!DR_IS_READ (a->ref))
+ if (DR_IS_WRITE (a->ref))
has_write = true;
}
return;
}
- qsort (VEC_address (dref, comp->refs), VEC_length (dref, comp->refs),
- sizeof (dref), order_drefs);
+ VEC_qsort (dref, comp->refs, order_drefs);
FOR_EACH_VEC_ELT (dref, comp->refs, i, a)
{
- if (!chain || !DR_IS_READ (a->ref)
+ if (!chain || DR_IS_WRITE (a->ref)
|| double_int_ucmp (uhwi_to_double_int (MAX_DISTANCE),
double_int_sub (a->offset, last_ofs)) <= 0)
{
&& TREE_CODE (ref) != MEM_REF)
return unshare_expr (ref);
- if (INDIRECT_REF_P (ref)
- || TREE_CODE (ref) == MEM_REF)
+ if (TREE_CODE (ref) == MEM_REF)
{
- /* Take care for MEM_REF and MISALIGNED_INDIRECT_REF at
- the same time. */
ret = unshare_expr (ref);
idx = TREE_OPERAND (ref, 0);
idx_p = &TREE_OPERAND (ret, 0);
gcc_assert (chain->type == CT_INVARIANT);
gcc_assert (!chain->combined);
FOR_EACH_VEC_ELT (dref, chain->refs, i, a)
- if (!DR_IS_READ (a->ref))
+ if (DR_IS_WRITE (a->ref))
n_writes++;
/* If there are no reads in the loop, there is nothing to do. */
bool is_read = DR_IS_READ (a->ref);
mark_virtual_ops_for_renaming (a->stmt);
- if (!DR_IS_READ (a->ref))
+ if (DR_IS_WRITE (a->ref))
{
n_writes--;
if (n_writes)
return NULL;
}
+ else if (is_gimple_debug (stmt))
+ continue;
else if (ret != NULL)
return NULL;
else
static bool
tree_predictive_commoning_loop (struct loop *loop)
{
+ VEC (loop_p, heap) *loop_nest;
VEC (data_reference_p, heap) *datarefs;
VEC (ddr_p, heap) *dependences;
struct component *components;
dependence relations. */
datarefs = VEC_alloc (data_reference_p, heap, 10);
dependences = VEC_alloc (ddr_p, heap, 10);
- compute_data_dependences_for_loop (loop, true, &datarefs, &dependences);
+ loop_nest = VEC_alloc (loop_p, heap, 3);
+ compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
+ &dependences);
if (dump_file && (dump_flags & TDF_DETAILS))
dump_data_dependence_relations (dump_file, dependences);
components = split_data_refs_to_components (loop, datarefs, dependences);
+ VEC_free (loop_p, heap, loop_nest);
free_dependence_relations (dependences);
if (!components)
{