[PATCH] D156612: [SimplifyCFG] Find the smallest table considering overflow in `switchToLookupTable`

DianQK via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 07:59:23 PDT 2023


DianQK added a comment.

I need to check these test case changes carefully.

I ran llvm-lit with alive. The result is:

  Failed Tests (2):
    LLVM :: Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
    LLVM :: Transforms/SimplifyCFG/speculate-call.ll

I haven't focused on whether this is an issue with alive or in itself, but it doesn't seem to be related to this patch.

I believe `@signed_overflow1`, `@signed_overflow2`, and `@signed_overflow_negative` have all changed for the better. `@signed_overflow1` and `@signed_overflow_negative` exchange results. But since we prefer to start at 0, this reduces the number of sub/add instructions by one.
`@covered_switch_with_bit_tests` also becomes better, smaller table and fewer commands.
`@f_i8_128` is our new test. `@_TFO6reduce1E5toRawfS0_FT_Si` becomes better.

`@f_min_max_2`, `@f_min_max`, `@test`, and `@coveredswitch_test` look to become worse. But their table size did get smaller.
I rechecked `@f_min_max_2`, `@f_min_max` and `@test`. They become from `table with holes` to `table without holes`. It's a "perfect" table? 
I've also found that they *luckily* have a max and min value. Then we created a cover table.
If we want to deal with this situation, maybe we should add a condition to extend to a cover table.

// TODO: `@coveredswitch_test`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156612/new/

https://reviews.llvm.org/D156612



More information about the llvm-commits mailing list