[PATCH] Improving LowerSwitch behavior for contiguous ranges

Joerg Sonnenberger joerg at britannica.bec.de
Tue Jun 10 10:37:09 PDT 2014


On Tue, Jun 10, 2014 at 01:26:07PM +0100, Marcello Maggioni wrote:
> switch (a) {
> case 0:
>   do0();
>   break;
> case 1:
>   do1();
>   break;
> case 2:
>   do2();
>   break;
> default:
>   break;
> }

Can you also check what your changes do if default is unreachable?
I don't know if we currently handle exploit that to ignore holes have
have a flat tree, e.g. in this case the trinary check for <,==,> 1.
Actually, depending on the architecture that might be the preferred form
anyway...

Joerg



More information about the llvm-commits mailing list