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

Cong Hou via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 16:07:58 PDT 2015


congh added a comment.

No, the subtraction is not from this patch. Originally, if the value can fit in 64-bit, the min value will be set to zero before visitBitTestHeader() is called, so a subtraction by zero will be eliminated. In this patch, when the value can fit in 64-bit, I check if the value range is contiguous. If it is, I assume we can save more than a subtraction with the optimization done in this patch. Therefore I still do the subtraction in this case, and the branch to the default statement will be eliminated. Otherwise, the subtraction will not be done as there is always a branch to the default statement.


http://reviews.llvm.org/D12249





More information about the llvm-commits mailing list