On Fri, Jun 25, 2010 at 12:45 PM, Eric Botcazou <[email protected]> wrote:
>> I do think so.
>
> Huh? What do your version and mine return for the following assignment?
>
> void foo (int i)
> {
> struct S s;
> s.a = i;
> }
>
>> Which in the following example makes i = *p not likely eliminated
>> but makes j = *q likely eliminated.
>>
>> void foo (int *p, struct X *q)
>> {
>> int i;
>> struct X j;
>> i = *p;
>> j = *q;
>> bar (&i, &q);
>> }
>>
>> That doesn't make sense.
>
> Yet that's what's supposed to be implemented, see the comment: "loads from
> parameters passed by reference".
>
>> What makes sense is that all scalar (thus gimple_reg_typed)
>> loads/stores to/from parameters or the result are free.
>
> Precisely not, they aren't free, otherwise they wouldn't exist in the first
> place. Scalar loads/stores are never free, aggregate loads/stores may be
> free if they are created only to pass the object around.
Err. aggregate loads/stores do not appear because aggregate
uses can appear in calls.
Scalar uses cannot appear in calls and thus you see them as
separate statements.
Thus,
struct X;
void bar(struct X);
void foo(struct X&x)
{
bar (x);
}
will appear as a single call stmt while
void bar (int);
void foo(int &x)
{
bar (x);
}
will have a load that is not supposed to be "free"?
Richard.
> --
> Eric Botcazou
>