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: Improve tree-ssa-forwprop


In message <98q2MeDXw-B@khms.westfalen.de>, Kai Henningsen writes:
 >law@redhat.com  wrote on 13.05.04 in <200405132052.i4DKqX1H019492@speedy.slc.
 >redhat.com>:
 >
 >> +      bb0:
 >> +        x = (typecast) a
 >> +        if (x) goto ... else goto ...
 >> +
 >> +    Will be transformed into:
 >> +
 >> +      bb0:
 >> +         if (a != 0) goto ... else goto ...
 >> +
 >> +    (Assuming a is an integral type and x is a boolean or x is an
 >> +     integral and a is a boolean.)
 >
 >What about stuff like
 >
 >        long x, a = 0xff8800;
 >        /* obviously in reality this wouldn't be a constant */
 >
 >        x = (unsigned char) a;
 >        if (x) ...
In that case the folder should transform the first assignment into 
x = 0;

After that the value should be propagated into the conditional and
the conditional optimized appropriately.

jeff


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