This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Rewrite store-motion and invariant motion to use an alias-oracle
On Wed, 19 Mar 2008, Zdenek Dvorak wrote:
> Hi,
>
> > void **slot;
> > struct name_expansion *exp;
> >
> > ! aff_combination_zero (&to_add, comb->type);
> > for (i = 0; i < comb->n; i++)
> > {
> > e = comb->elts[i].val;
> > + /* We can strip extensions as we re-apply them after expansion. */
> > + if (TREE_CODE (e) == NOP_EXPR
> > + && (TYPE_PRECISION (TREE_TYPE (e))
> > + >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (e, 0)))))
> > + e = TREE_OPERAND (e, 0);
> > if (TREE_CODE (e) != SSA_NAME)
> > continue;
> > def = SSA_NAME_DEF_STMT (e);
> > *************** tree_to_aff_combination_expand (tree exp
> > *** 632,639 ****
> > COMB while traversing it; include the term -coef * E, to remove
> > it from COMB. */
> > scale = comb->elts[i].coef;
> > ! aff_combination_zero (&curre, type);
> > ! aff_combination_add_elt (&curre, e, double_int_neg (scale));
> > aff_combination_scale (¤t, scale);
> > aff_combination_add (&to_add, ¤t);
> > aff_combination_add (&to_add, &curre);
> > --- 628,636 ----
> > COMB while traversing it; include the term -coef * E, to remove
> > it from COMB. */
> > scale = comb->elts[i].coef;
> > ! aff_combination_zero (&curre, comb->type);
> > ! aff_combination_add_elt (&curre, comb->elts[i].val,
> > ! double_int_neg (scale));
> > aff_combination_scale (¤t, scale);
> > aff_combination_add (&to_add, ¤t);
> > aff_combination_add (&to_add, &curre);
>
> it seems do you do not actually reapply the extension as you promise
> in the comment above?
The original expression is subtracted (comb->elts[i].val) and the
expansion is applied to the leaf expressions via the following hunk.
*************** tree_to_aff_combination (tree expr, tree
*** 338,344 ****
break;
}
! aff_combination_elt (comb, type, expr);
}
/* Creates EXPR + ELT * SCALE in TYPE. EXPR is taken from affine
--- 338,344 ----
break;
}
! aff_combination_elt (comb, type, fold_convert (type, expr));
}
/* Creates EXPR + ELT * SCALE in TYPE. EXPR is taken from affine
(maybe there's a better place to do it, but it really needs to be
done on the leaf of expanded expressions).
Richard.