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]

Re: Value Range Propagation Pass Status


> Notice that the out of range check has been eliminated in addition to
> those cases which will never occur.

I'd like the range check for switches on certain enums to be eliminated.
In C, enums can actually have a value that's not in the enumeration list
which defeats the optimisation: you can't assume every case is covered.
However, there are two approaches to eliminating the bounds check:

   - __builtin_assume (x < 6);

   - __attribute__ ((bounded)) enum Foo { A, B, C} foo;

I like the second better for enum types, but the first is a more general
purpose solution.

thanks,
-- Jamie

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