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

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 15:47:58 PDT 2015


davidxl added a comment.

I have not looked at the details. Does your patch work for the case when a min value is not zero:

define void @foo(i32 %x) {
entry:

  switch i32 %x, label %return [
    i32 1, label %bb0
    i32 3, label %bb0
    i32 5, label %bb0
    i32 2, label %bb1
    i32 4, label %bb1
    i32 6, label %bb1
  ]

bb0: tail call void @a() br label %return
bb1: tail call void @b() br label %return
return: ret void
}
declare void @a()
declare void @b()


http://reviews.llvm.org/D12249





More information about the llvm-commits mailing list