[PATCH] D12249: Remove the final bit test during lowering switch statement if all cases in bit test cover a contiguous range.

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 11:25:47 PDT 2015


hans added a comment.

Looks great! I like this :-)

Please add tests for the cases where this doesn't fire too.


================
Comment at: test/CodeGen/X86/switch.ll:419
@@ -413,1 +418,3 @@
+; The range check guarantees that cases other than 1,4,7 and 2,5,8,9 must be
+; in 0,3,6.
 
----------------
I think this means the optimization affects both bit-test tests in this file. It would be great to have tests where it doesn't fire too, either because the case range is not covered, or because of the "fits in machine word, so optimize away subtraction" case.


http://reviews.llvm.org/D12249





More information about the llvm-commits mailing list