fix an x86 fast isel issue where we'd completely give up on folding an address
authorChris Lattner <sabre@nondot.org>
Sun, 17 Apr 2011 17:47:38 +0000 (17:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Apr 2011 17:47:38 +0000 (17:47 +0000)
commit0a1c997c27706e315efb61b8b3e110d42cbaae64
tree2500a0cef747db77484d7d4c86c879c7ea0abd92
parent685090f5988a03da1a515493bad1e592d26b9956
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
lib/Target/X86/X86FastISel.cpp
test/CodeGen/X86/fast-isel-x86-64.ll