[PATCH] D21291: [SimplifyCFG] Range reduce switches

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 14:31:23 PDT 2016

jmolloy added inline comments.

Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5056
@@ +5055,3 @@
+  OldBB->getTerminator()->eraseFromParent();
+  BranchInst::Create(SI->getParent(), SI->getDefaultDest(), Cmp, OldBB);
eli.friedman wrote:
> If we were doing this in SelectionDAG, we would be able to combine this branch with the jump table's bounds check: "ROTATE(X - Base, Shift) > Limit".
Hmm, you're close to convincing me. I'm loath to give up the lookup table optimization though.

How gross (/ acceptable) would it be to implement this in SelectionDAG and then also teach lookup table lowering in SimplifyCFG this trick too?



More information about the llvm-commits mailing list