[all-commits] [llvm/llvm-project] 925f46: [SimplifyCFG] Precommit tests for PR65835

Allen via All-commits all-commits at lists.llvm.org
Thu Oct 26 04:04:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 925f4622dcd09e0d70c6d30779e0c119fb12ce00
      https://github.com/llvm/llvm-project/commit/925f4622dcd09e0d70c6d30779e0c119fb12ce00
  Author: zhongyunde 00443407 <zhongyunde at huawei.com>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    A llvm/test/Transforms/SimplifyCFG/switch_mask.ll

  Log Message:
  -----------
  [SimplifyCFG] Precommit tests for PR65835


  Commit: 5e07481d4240b5e8fd85f9b92df30849606c2af0
      https://github.com/llvm/llvm-project/commit/5e07481d4240b5e8fd85f9b92df30849606c2af0
  Author: zhongyunde 00443407 <zhongyunde at huawei.com>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/switch_mask.ll

  Log Message:
  -----------
  [SimplifyCFG] Delete the unnecessary range check for small mask operation

When the small mask value little than 64, we can eliminate the checking
for upper limit of the range by enlarge the lookup table size to the maximum
index value. (Then the final table size grows to the next pow2 value)
```
bool f(unsigned x) {
    switch (x % 8) {
        case 0: return 1;
        case 1: return 0;
        case 2: return 0;
        case 3: return 1;
        case 4: return 1;
        case 5: return 0;
        case 6: return 1;

        // This would remove the range check: case 7: return 0;
    }
    return 0;
}
```
Use WouldFitInRegister instead of fitsInLegalInteger to support
more result type beside bool.

Fixes https://github.com/llvm/llvm-project/issues/65120
Reviewed By: zmodem, nikic, RKSimon


Compare: https://github.com/llvm/llvm-project/compare/85f6b2fac9a3...5e07481d4240


More information about the All-commits mailing list