diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-26 00:26:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-26 00:26:16 +0000 |
commit | 2efbbb38ba7b9601202f2271301f07195dea8959 (patch) | |
tree | a5cfb199a202b4901c74c9c4823cf3e01aa9ad22 /test/CodeGen/X86/isel-sink2.ll | |
parent | 6d235bb7a05c17f1c06def0c1c249150b7e9a53a (diff) | |
download | llvm-2efbbb38ba7b9601202f2271301f07195dea8959.tar.gz llvm-2efbbb38ba7b9601202f2271301f07195dea8959.tar.bz2 llvm-2efbbb38ba7b9601202f2271301f07195dea8959.tar.xz |
Teach CodeGenPrepare to look through Bitcast instructions when attempting to
optimize addressing modes. This allows us to optimize things like isel-sink2.ll
into:
movl 4(%esp), %eax
cmpb $0, 4(%eax)
jne LBB1_2 ## F
LBB1_1: ## TB
movl $4, %eax
ret
LBB1_2: ## F
movzbl 7(%eax), %eax
ret
instead of:
_test:
movl 4(%esp), %eax
cmpb $0, 4(%eax)
leal 4(%eax), %eax
jne LBB1_2 ## F
LBB1_1: ## TB
movl $4, %eax
ret
LBB1_2: ## F
movzbl 3(%eax), %eax
ret
This shrinks (e.g.) 403.gcc from 1133510 to 1128345 lines of .s.
Note that the 2008-10-16-SpillerBug.ll testcase is dubious at best, I doubt
it is really testing what it thinks it is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/isel-sink2.ll')
-rw-r--r-- | test/CodeGen/X86/isel-sink2.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGen/X86/isel-sink2.ll b/test/CodeGen/X86/isel-sink2.ll new file mode 100644 index 0000000000..d8e27e9aff --- /dev/null +++ b/test/CodeGen/X86/isel-sink2.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep {movzbl.7(%...)} +; RUN: llvm-as < %s | llc -march=x86 | not grep leal + +define i8 @test(i32 *%P) nounwind { + %Q = getelementptr i32* %P, i32 1 + %R = bitcast i32* %Q to i8* + %S = load i8* %R + %T = icmp eq i8 %S, 0 + br i1 %T, label %TB, label %F +TB: + ret i8 4 +F: + %U = getelementptr i8* %R, i32 3 + %V = load i8* %U + ret i8 %V +} |