llvm-mirror/lib
Chris Lattner e92f8121d4 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.

llvm-svn: 122045
2010-12-17 06:20:15 +00:00
..
Analysis Update a comment. 2010-12-16 02:55:10 +00:00
Archive MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
AsmParser MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
Bitcode Generalize the darwin wrapper hack to work with generic macho triples as well as darwin ones. 2010-11-29 23:29:54 +00:00
CodeGen Provide LiveIntervalUnion::Query::checkLoopInterference. 2010-12-17 04:09:47 +00:00
CompilerDriver Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
ExecutionEngine Remove unneeded zero arrays. 2010-12-04 15:28:22 +00:00
Linker MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
MC MC/Expr: Implemnt more aggressive folding during symbol evaluation using 2010-12-17 05:50:33 +00:00
Object MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
Support Trailing whitespace and 80 column fixups. 2010-12-17 02:10:59 +00:00
Target MC/ARM: Use aggressive symbol folding (important for jump tables, for example). 2010-12-17 06:00:24 +00:00
Transforms improve switch formation to handle small range 2010-12-17 06:20:15 +00:00
VMCore MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm. 2010-12-16 03:29:14 +00:00
Makefile Add LLVMObject Library. 2010-11-15 03:21:41 +00:00