[PATCH] D128897: [SimplifyCFG] Improve SwitchToLookupTable optimization

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 1 19:27:45 PDT 2022


alexander-shaposhnikov added a comment.

Many thanks for the comments!
I was looking at 
https://github.com/llvm/llvm-project/blob/537db49596f65a05c0309cf3333fc44f1657e999/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L5905 
and https://github.com/llvm/llvm-project/blob/537db49596f65a05c0309cf3333fc44f1657e999/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L5932, 
the class supports different offset values (but yeah, the previous version was passing MinCaseVal to the constructor everywhere) (unless I'm missing something).
Going back and  manually adding cases seems to be unnecessary / causes some duplication.

I've done more testing/verification:

1/ https://alive2.llvm.org/ce/z/dsktej (use_x_as_index_default_value)
2/ https://alive2.llvm.org/ce/z/yAF2aM (use_x_as_index_mask)
3/ Bootstrapped LLVM/Clang tests are green
4/ https://alive2.llvm.org/ce/z/sLoMn1 (example above)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128897



More information about the llvm-commits mailing list