[llvm-commits] Please review the patch for IntegersSubsetMapping

Stepan Dyatkovskiy stpworld at narod.ru
Mon Jul 9 09:54:17 PDT 2012


Stepan Dyatkovskiy wrote:
> SimplifyCFG pass will optimize two these folded switches to the single one:
>
> switch (c) {
>     case '0'..'1': // BITS_SPECIFIC_SUBSET
>       tryProcessBit(c);
>       break;
>     case '2'..'9': // DECS_SPECIFIC_SUBSET
>       tryProcessDecs(c);
>       break;
>     case 'A'..'F': // HEXS_SPECIFIC_SUBSET
>       tryProcessHexs(c);
>       break;
>     default:
>       processSomethingElse();
> }

Forgot about '\\' character. Fixed simplified switch is below:

switch (c) {
    case '0'..'1': // BITS_SPECIFIC_SUBSET
      tryProcessBit(c);
      break;
    case '2'..'9': // DECS_SPECIFIC_SUBSET
      tryProcessDecs(c);
      break;
    case 'A'..'F': // HEXS_SPECIFIC_SUBSET
      tryProcessHexs(c);
      break;
    case '\\":
      processEscape();
      break;
    default:
      processSomethingElse();
}

-Stepan.





More information about the llvm-commits mailing list