Go to file
James Molloy b2e436de42 [SimplifyCFG] Range reduce switches
If a switch is sparse and all the cases (once sorted) are in arithmetic progression, we can extract the common factor out of the switch and create a dense switch. For example:

    switch (i) {
    case 5: ...
    case 9: ...
    case 13: ...
    case 17: ...
    }

can become:

    if ( (i - 5) % 4 ) goto default;
    switch ((i - 5) / 4) {
    case 0: ...
    case 1: ...
    case 2: ...
    case 3: ...
    }

or even better:

   switch ( ROTR(i - 5, 2) {
   case 0: ...
   case 1: ...
   case 2: ...
   case 3: ...
   }

The division and remainder operations could be costly so we only do this if the factor is a power of two, and emit a right-rotate instead of a divide/remainder sequence. Dense switches can be lowered significantly better than sparse switches and can even be transformed into lookup tables.

llvm-svn: 277325
2016-08-01 07:45:11 +00:00
clang Add more gcc compatibility names to clang's cpuid.h 2016-07-31 20:23:23 +00:00
clang-tools-extra [clang-tidy] add check cppcoreguidelines-special-member-functions 2016-07-30 08:58:54 +00:00
compiler-rt [asan] Reduce flakiness of heavy recovery mode tests. 2016-08-01 07:24:36 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Make min follow the OCL 1.0 specs 2016-07-25 22:36:22 +00:00
libcxx Add a bunch of noexcepts to char_traits and string_view. 2016-07-28 04:52:02 +00:00
libcxxabi Attempt to bring peace to -Werror buildbots. 2016-07-19 20:35:09 +00:00
libunwind libunwind: correct return code in unwinding trace log message 2016-07-29 21:24:19 +00:00
lld Remove dead ctor. 2016-07-30 00:13:30 +00:00
lldb Some code that is sanity checking stepping out back out from one inlined 2016-07-29 18:09:12 +00:00
llgo [llgo] add llgo source path to LLVM_GO_PACKAGES 2016-07-27 03:01:00 +00:00
llvm [SimplifyCFG] Range reduce switches 2016-08-01 07:45:11 +00:00
openmp Make balanced affinity work on AArch64. 2016-07-29 20:55:03 +00:00
parallel-libs [StreamExecutor] Add error handling library 2016-07-29 20:45:52 +00:00
polly Add missing prefixes. 2016-07-30 11:15:00 +00:00