summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/fast-isel-x86-64.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-17 17:47:38 +0000
committerChris Lattner <sabre@nondot.org>2011-04-17 17:47:38 +0000
commit0a1c997c27706e315efb61b8b3e110d42cbaae64 (patch)
tree2500a0cef747db77484d7d4c86c879c7ea0abd92 /test/CodeGen/X86/fast-isel-x86-64.ll
parent685090f5988a03da1a515493bad1e592d26b9956 (diff)
downloadllvm-0a1c997c27706e315efb61b8b3e110d42cbaae64.tar.gz
llvm-0a1c997c27706e315efb61b8b3e110d42cbaae64.tar.bz2
llvm-0a1c997c27706e315efb61b8b3e110d42cbaae64.tar.xz
fix an x86 fast isel issue where we'd completely give up on folding an address
when we have a global variable base an an index. Instead, just give up on folding the global variable. Before we'd geenrate: _test: ## @test ## BB#0: movq _rtx_length@GOTPCREL(%rip), %rax leaq (%rax), %rax addq %rdi, %rax movzbl (%rax), %eax ret now we generate: _test: ## @test ## BB#0: movq _rtx_length@GOTPCREL(%rip), %rax movzbl (%rax,%rdi), %eax ret The difference is even more significant when there is a scale involved. This fixes rdar://9289558 - total fail with addr mode formation at -O0/x86-64 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/fast-isel-x86-64.ll')
-rw-r--r--test/CodeGen/X86/fast-isel-x86-64.ll24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/CodeGen/X86/fast-isel-x86-64.ll b/test/CodeGen/X86/fast-isel-x86-64.ll
index c0815aaff5..e98c4730af 100644
--- a/test/CodeGen/X86/fast-isel-x86-64.ll
+++ b/test/CodeGen/X86/fast-isel-x86-64.ll
@@ -28,11 +28,11 @@ if.then: ; preds = %entry
if.end: ; preds = %if.then, %entry
ret void
-}
-
; CHECK: test2:
; CHECK: movq %rdi, -8(%rsp)
; CHECK: cmpq $42, -8(%rsp)
+}
+
@@ -40,8 +40,24 @@ if.end: ; preds = %if.then, %entry
define i64 @test3() nounwind {
%A = ptrtoint i32* @G to i64
ret i64 %A
-}
-
; CHECK: test3:
; CHECK: movq _G@GOTPCREL(%rip), %rax
; CHECK-NEXT: ret
+}
+
+
+
+; rdar://9289558
+@rtx_length = external global [153 x i8]
+
+define i32 @test4(i64 %idxprom9) nounwind {
+ %arrayidx10 = getelementptr inbounds [153 x i8]* @rtx_length, i32 0, i64 %idxprom9
+ %tmp11 = load i8* %arrayidx10, align 1
+ %conv = zext i8 %tmp11 to i32
+ ret i32 %conv
+
+; CHECK: test4:
+; CHECK: movq _rtx_length@GOTPCREL(%rip), %rax
+; CHECK-NEXT: movzbl (%rax,%rdi), %eax
+; CHECK-NEXT: ret
+}