"make check" failures: leaq in fold-mul-lohi.ll, stride-nine-with-base-reg.ll, stride-reuse.ll

I'm seeing the following failures with "make check" (x86-32 linux):

FAIL: test/CodeGen/X86/fold-mul-lohi.ll
Failed with exit(1) at line 2
while running: llvm-as < test/CodeGen/X86/fold-mul-lohi.ll | llc -march=x86-64 | not grep lea
        leaq B, %rsi
        leaq A, %r8
        leaq P, %rsi
child process exited abnormally
FAIL: test/CodeGen/X86/stride-nine-with-base-reg.ll
Failed with exit(1) at line 2
while running: llvm-as < test/CodeGen/X86/stride-nine-with-base-reg.ll | llc -march=x86-64 | not grep lea
        leaq B, %rdx
        leaq A, %r8
        leaq P, %rdx
child process exited abnormally
FAIL: test/CodeGen/X86/stride-reuse.ll
Failed with exit(1) at line 2
while running: llvm-as < test/CodeGen/X86/stride-reuse.ll | llc -march=x86-64 | not grep lea
        leaq B, %rsi
        leaq A, %rsi
        leaq P, %rsi
child process exited abnormally

Fixed. Thanks.

Evan

Hi Evan,

In -relocation-model=static mode, those tests are now getting
code like this

        leaq A, %rsi
        movss %xmm0, (%rsi,%rdx,4)

instead of this:

        movss %xmm0, A(,%rdx,4)

This is specifically what these tests were written to catch :-).
Running them with -relocation-model=pic is hiding the real bug.

Dan

Fixed. However, I wonder if we are doing the right / smart codegen for static codegen. AMD64 ABI document seems to indicate rip relative addressing should be used even in this case (see page 38). You know about about Linux addressing mode than I do. Please check.

Thanks,

Evan

Rip-relative addressing can't be used with an index register, so
in cases where an index register is being used, the benefit of using
rip-relative addressing in non-PIC modes is outweighed by the
additional instructions and registers needed to do the index
computations.

The examples on page 38 don't have any cases with indicies :-).

Dan