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: [tree-ssa] Remove useless null pointer checks


In message <wvloez4vwvo.fsf@prospero.boston.redhat.com>, Jason Merrill writes:
 >> If the main variant of TYPE and RHS is the same, then enter LHS = RHS into
 >> the const_and_copies table.
 >>
 >> If TYPE and RHS's type are both pointers and one is a void *, then enter
 >> LHS = RHS into the const_and_copies table.
 >
 >You should also handle casts between pointer and reference type; they are
 >equivalent outside the front end.
OK.  I'll poke and see what I can do with reference types as well.


 >> For integral types, we can safely call STRIP_SIGN_NOPS to remove any
 >> casts which do not change the underlying mode or sign.
 >>
 >> There may be other "rules" we could use for typecasts which are safe to
 >> ignore in the gimplifier and tree-ssa optimizers. 
 >>
 >> Thoughts?
 >
 >Could we go all the way and allow any cast which doesn't change mode or
 >sign?
Well, I'm doing that for integral types right now.  I ran into problems
with doing it on pointer types though since we ended up changing a
(int *) to an (unsigned int *) or something like that -- which in turn
caused indigestion for some of the argument checking code for builtins
(IIRC).  For a pointers I think you need to apply the rule on the underlying
type (s).

Jeff











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