[llvm-commits] [LLVM, SwitchInst, case ranges] Auxiliary patch #1
Duncan Sands
baldrick at free.fr
Mon Oct 31 23:56:10 PDT 2011
Hi Anton,
>> be the opposite: they might make switches harder to work with and reason about
>> for no advantage. Which is it? Do you have an example where case ranges would
>> result in better code, or make it easier to produce better code?
> I think the typical example is some code which produces large
> switches. In the frontend we
> won't emit such large switches and end with explicit comparisons instead.
>
> Do you have some example of this from Ada world? I believe I saw
> something like this in Polyhedron, but I'm not sure.
this happens all the time with Ada, for example with ranges like "all negative
numbers". Currently the front-end emits explicit compares and branches for the
big ranges (more than 64 cases), and a switch for the rest. If LLVM switches
had ranges, would LLVM produce better code for this kind of thing?
Ciao, Duncan.
More information about the llvm-commits
mailing list