diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-12-17 06:20:15 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-12-17 06:20:15 +0000 |
| commit | d14b0f1db7a6ca8b17adbeec25fea2eb2b907040 (patch) | |
| tree | 335b59f9c2b5fab76491d8a4dc7a9444ef159f54 /lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | |
| parent | e054a782fc6bf4c5a48d28999a17d9ca181737bc (diff) | |
| download | llvm-d14b0f1db7a6ca8b17adbeec25fea2eb2b907040.zip llvm-d14b0f1db7a6ca8b17adbeec25fea2eb2b907040.tar.gz llvm-d14b0f1db7a6ca8b17adbeec25fea2eb2b907040.tar.bz2 | |
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp')
0 files changed, 0 insertions, 0 deletions
