summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-07-03 07:38:12 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-07-03 07:38:12 +0000
commitb4a74c1d820bd913e91e4c921a141824f6bfe2df (patch)
treeb22c5c0be1bd40666c4d4f16f01defed19afdd0d /lib/Target/README.txt
parent68b559e5f34b787fac04eb617c451cc840a473b4 (diff)
downloadllvm-b4a74c1d820bd913e91e4c921a141824f6bfe2df.tar.gz
llvm-b4a74c1d820bd913e91e4c921a141824f6bfe2df.tar.bz2
llvm-b4a74c1d820bd913e91e4c921a141824f6bfe2df.tar.xz
Note switch-lowering inefficiency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index b1080b594f..8f785393fd 100644
--- a/lib/Target/README.txt
+++ b/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.
+
+//===---------------------------------------------------------------------===//