Value Range Propagation Pass Status

Jamie Lokier jamie.lokier@cern.ch
Sat Feb 5 03:41:00 GMT 2000


> 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


More information about the Gcc mailing list