This is the mail archive of the gcc@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: Redundant limit check for switch



Why can't this information be used to optimize comparisons?


My patch caused GCC to infer that x & 7 > 7 is false. But I couldn't think of a quick way to use this to optimize away the check, because then GCC crashed.

Does it work only for consecutive ands?
Or is it just an early constant folding:
return (x + 1) & (0x0f & 0x0c & 0x3ff & 0xff);
?

In this case, it is.

Paolo


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