[llvm] [SimplifyCFG] Delete the unnecessary range check for small mask operation (PR #65835)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 06:15:40 PDT 2023


================
@@ -6545,6 +6544,17 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
 
   BranchInst *RangeCheckBranch = nullptr;
 
+  if (UseSwitchConditionAsTableIndex) {
----------------
zmodem wrote:

Please add a comment about what this does (grows the table to cover all possible index values to avoid the range check).

It would also be good if the commit message explained this a bit better: it's not really about mask operations, but any situation when the index range is limited. One way to do it is to include a small C example in the commit message.

https://github.com/llvm/llvm-project/pull/65835


More information about the llvm-commits mailing list