This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Value Range Propagation Pass Status
- To: John Wehle <john at feith dot com>
- Subject: Re: Value Range Propagation Pass Status
- From: Jamie Lokier <jamie dot lokier at cern dot ch>
- Date: Sat, 5 Feb 2000 12:41:11 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <200002040035.TAA22792@jwlab.FEITH.COM>
> 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