[PATCH] D52002: Switch optimization for known maximum switch values
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 11 07:07:26 PDT 2018
hans added a comment.
This is looking pretty good, so I'd suggest start writing tests. For testing, take a look at test/CodeGen/X86/switch.ll
I think we could also exploit unreachable default for the other lowering strategies (bit-tests, straight comparisons and binary search tree), but that can be done in later patches.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:9452
+ isa<UnreachableInst>(SI->getDefaultDest()->getFirstNonPHIOrDbg());
+ bool OmitRangeCheck = UnreachableDefault && SI->getNumCases() > 0;
JumpTable JT(-1U, JTI, JumpTableMBB, nullptr);
----------------
There seems to be an extra space between "Default" and "&&". Also, why do we need the SI->getNumCases() check?
https://reviews.llvm.org/D52002
More information about the llvm-commits
mailing list