Teach spiller to unfold instructions which modref spill slot when a scratch
authorEvan Cheng <evan.cheng@apple.com>
Fri, 17 Apr 2009 01:29:40 +0000 (01:29 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 17 Apr 2009 01:29:40 +0000 (01:29 +0000)
commit276b77e66c538264d79b78c00bbad9f890f58011
treef668c05c94b70225a5bc83d12f1e1912cb485226
parentd10a4ce5825d0981107c0106c49089b9e5792e40
Teach spiller to unfold instructions which modref spill slot when a scratch
register is available and when it's profitable.

e.g.
     xorq  %r12<kill>, %r13
     addq  %rax, -184(%rbp)
     addq  %r13, -184(%rbp)
==>
     xorq  %r12<kill>, %r13
     movq  -184(%rbp), %r12
     addq  %rax, %r12
     addq  %r13, %r12
     movq  %r12, -184(%rbp)

Two more instructions, but fewer memory accesses. It can also open up
opportunities for more optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69341 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/Spiller.cpp
lib/CodeGen/Spiller.h
test/CodeGen/X86/2009-04-16-SpillerUnfold.ll [new file with mode: 0644]