diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-07-03 07:38:12 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-07-03 07:38:12 +0000 |
commit | 836fdbc85b8ffe112e31ffc7ad478162c8a806f0 (patch) | |
tree | 5c2bcd38e2e074c67ec1366b0e4f3be73bdfbc0a /llvm/lib/Target | |
parent | 0029a2a9579c4222c8feea85c2e4d5047297438e (diff) | |
download | bcm5719-llvm-836fdbc85b8ffe112e31ffc7ad478162c8a806f0.tar.gz bcm5719-llvm-836fdbc85b8ffe112e31ffc7ad478162c8a806f0.zip |
Note switch-lowering inefficiency.
llvm-svn: 107565
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/README.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt index b1080b594ff..8f785393fd0 100644 --- a/llvm/lib/Target/README.txt +++ b/llvm/lib/Target/README.txt @@ -1888,3 +1888,39 @@ of the ADD, and replacing the ADD with the ADDE, should give the desired result. (That said, we are doing a lot better than gcc on this testcase. :) ) //===---------------------------------------------------------------------===// + +Switch lowering generates less than ideal code for the following switch: +define void @a(i32 %x) nounwind { +entry: + switch i32 %x, label %if.end [ + i32 0, label %if.then + i32 1, label %if.then + i32 2, label %if.then + i32 3, label %if.then + i32 5, label %if.then + ] +if.then: + tail call void @foo() nounwind + ret void +if.end: + ret void +} +declare void @foo() + +Generated code on x86-64 (other platforms give similar results): +a: + cmpl $5, %edi + ja .LBB0_2 + movl %edi, %eax + movl $47, %ecx + btq %rax, %rcx + jb .LBB0_3 +.LBB0_2: + ret +.LBB0_3: + xorb %al, %al + jmp foo@PLT # TAILCALL + +The movl+movl+btq+jb could be simplified to a cmpl+jne. + +//===---------------------------------------------------------------------===// |