diff options
author | Chris Lattner <sabre@nondot.org> | 2011-04-17 17:47:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-04-17 17:47:38 +0000 |
commit | eb729d48ff586494d59c5a1716a335137160406b (patch) | |
tree | e42c0272e31c114c3461bb3f6452a455b2773eb6 /llvm/test/CodeGen/X86/fast-isel-x86-64.ll | |
parent | 4832660b4d62462ee83f4131accaa64991c01dfe (diff) | |
download | bcm5719-llvm-eb729d48ff586494d59c5a1716a335137160406b.tar.gz bcm5719-llvm-eb729d48ff586494d59c5a1716a335137160406b.zip |
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
llvm-svn: 129664
Diffstat (limited to 'llvm/test/CodeGen/X86/fast-isel-x86-64.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/fast-isel-x86-64.ll | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/X86/fast-isel-x86-64.ll b/llvm/test/CodeGen/X86/fast-isel-x86-64.ll index c0815aaff57..e98c4730af7 100644 --- a/llvm/test/CodeGen/X86/fast-isel-x86-64.ll +++ b/llvm/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 +} |