Chris Lattner
e27db74a60
improve switch formation to handle small range
comparisons formed by comparisons. For example,
this:
void foo(unsigned x) {
if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6)
bar();
}
compiles into:
_foo: ## @foo
## BB#0: ## %entry
cmpl $6, %edi
ja LBB0_2
## BB#1: ## %entry
movl %edi, %eax
movl $91, %ecx
btq %rax, %rcx
jb LBB0_3
instead of:
_foo: ## @foo
## BB#0: ## %entry
cmpl $2, %edi
jb LBB0_4
## BB#1: ## %switch.early.test
cmpl $6, %edi
ja LBB0_3
## BB#2: ## %switch.early.test
movl %edi, %eax
movl $88, %ecx
btq %rax, %rcx
jb LBB0_4
This catches a bunch of cases in GCC, which look like this:
%804 = load i32* @which_alternative, align 4, !tbaa !0
%805 = icmp ult i32 %804, 2
%806 = icmp eq i32 %804, 3
%or.cond121 = or i1 %805, %806
%807 = icmp eq i32 %804, 4
%or.cond124 = or i1 %or.cond121, %807
br i1 %or.cond124, label %.thread, label %808
turning this into a range comparison.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 06:20:15 +00:00
..
2010-11-29 19:44:50 +00:00
2010-12-07 18:11:54 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-21 00:28:59 +00:00
2010-11-29 18:16:10 +00:00
2010-10-25 12:47:22 +00:00
2010-12-17 06:20:15 +00:00
2010-11-05 07:19:09 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:47:54 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-13 02:48:51 +00:00
2010-11-29 19:44:50 +00:00
2010-12-09 17:37:02 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 19:44:50 +00:00
2010-11-18 02:15:42 +00:00
2010-12-16 03:29:14 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-12-15 22:33:06 +00:00
2010-11-29 19:44:50 +00:00
2010-12-16 03:29:14 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 18:16:10 +00:00
2010-11-18 02:15:42 +00:00
2010-12-01 02:46:41 +00:00
2010-12-07 18:12:07 +00:00
2010-11-17 18:52:15 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 19:44:50 +00:00
2010-11-17 08:13:01 +00:00
2010-10-18 18:50:27 +00:00
2010-11-29 18:16:10 +00:00
2010-12-09 17:36:48 +00:00
2010-11-03 16:14:16 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 19:44:50 +00:00
2010-11-29 18:16:10 +00:00
2010-11-29 18:16:10 +00:00
2010-10-07 20:32:40 +00:00
2010-11-29 19:44:50 +00:00