This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,4.4/4.5/4.6?] check for constant base addresses in is_gimple_invariant_address


On Sun, Sep 5, 2010 at 9:52 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Sun, Sep 05, 2010 at 10:36:16AM +0200, Richard Guenther wrote:
>> > Index: gcc/ChangeLog
>> > ===================================================================
>> > Index: gcc/gimple.c
>> > ===================================================================
>> > --- gcc/gimple.c ? ? ? ?(revision 163868)
>> > +++ gcc/gimple.c ? ? ? ?(working copy)
>> > @@ -2591,7 +2591,13 @@ is_gimple_invariant_address (const_tree
>> >
>> > ? op = strip_invariant_refs (TREE_OPERAND (t, 0));
>> >
>> > - ?return op && (CONSTANT_CLASS_P (op) || decl_address_invariant_p (op));
>> > + ?if (!op)
>> > + ? ?return false;
>> > +
>> > + ?if (TREE_CODE (op) == INDIRECT_REF)
>> > + ? ?return CONSTANT_CLASS_P (TREE_OPERAND (op, 0));
>> > +
>> > + ?return (CONSTANT_CLASS_P (op) || decl_address_invariant_p (op));
>> > ?}
>>
>> This doesn't make sense. ?If we are asking for &CST->x then we should have
>> folded it to a plain CST.
>
> I don't understand what you mean by this. ?Could you explain?

&CST->x is a constant, we should fold it to it instead of keeping the address-of
expression (if it wouldn't be a constant it wouldn't and shouldn't be
is_gimple_min_invariant either).

>> (and of course such a change wouldn't be appropriate for the release branches,
>> you basically change the GIMPLE IL)
>
> I'm happy to fix it however you like on mainline, but I'd also like to
> find a fix that works for release branches.

A fix that folds &CST->x to a constant would be appropriate.  And I think
we do such folding somewhere, just maybe not in the right place(s).

Richard.

> -Nathan
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]