diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-01 03:49:38 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-01 03:49:38 +0000 |
commit | aef3d140b74013c5042e730194fef48c01bfd27e (patch) | |
tree | 71c21652e399701cb0f4493ae2374ad0826090a8 /llvm/test/CodeGen | |
parent | 7c42659cee567b32fffea47229e7ec348ba73007 (diff) | |
download | bcm5719-llvm-aef3d140b74013c5042e730194fef48c01bfd27e.tar.gz bcm5719-llvm-aef3d140b74013c5042e730194fef48c01bfd27e.zip |
Teach fast-isel to avoid loading a value from memory when it's already
available in a register. This is pretty primitive, but it reduces the
number of instructions in common testcases by 4%.
llvm-svn: 107380
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/X86/fast-isel-loads.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fast-isel-loads.ll b/llvm/test/CodeGen/X86/fast-isel-loads.ll new file mode 100644 index 00000000000..2fbb46c0b9f --- /dev/null +++ b/llvm/test/CodeGen/X86/fast-isel-loads.ll @@ -0,0 +1,23 @@ +; RUN: llc -march=x86-64 -O0 -asm-verbose=false < %s | FileCheck %s + +; Fast-isel shouldn't reload the argument values from the stack. + +; CHECK: foo: +; CHECK-NEXT: movq %rdi, -8(%rsp) +; CHECK-NEXT: movq %rsi, -16(%rsp) +; CHECK-NEXT: movsd 128(%rsi,%rdi,8), %xmm0 +; CHECK-NEXT: ret + +define double @foo(i64 %x, double* %p) nounwind { +entry: + %x.addr = alloca i64, align 8 ; <i64*> [#uses=2] + %p.addr = alloca double*, align 8 ; <double**> [#uses=2] + store i64 %x, i64* %x.addr + store double* %p, double** %p.addr + %tmp = load i64* %x.addr ; <i64> [#uses=1] + %tmp1 = load double** %p.addr ; <double*> [#uses=1] + %add = add nsw i64 %tmp, 16 ; <i64> [#uses=1] + %arrayidx = getelementptr inbounds double* %tmp1, i64 %add ; <double*> [#uses=1] + %tmp2 = load double* %arrayidx ; <double> [#uses=1] + ret double %tmp2 +} |