1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

New virtual registers created for spill intervals should inherit allocation hints from the original register.

This helps us avoid silly copies when rematting values that are copied to a physical register:

leaq	_.str44(%rip), %rcx
movq	%rcx, %rsi
call	_strcmp

becomes:

leaq	_.str44(%rip), %rsi
call	_strcmp

The coalescer will not touch the movq because that would tie down the physical register.

llvm-svn: 90163
This commit is contained in:
Jakob Stoklund Olesen 2009-11-30 22:55:54 +00:00
parent bacc153c6c
commit ce2743a619
2 changed files with 7 additions and 1 deletions

View File

@ -1095,6 +1095,12 @@ rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI,
NewVReg = mri_->createVirtualRegister(rc);
vrm.grow();
CreatedNewVReg = true;
// The new virtual register should get the same allocation hints as the
// old one.
std::pair<unsigned, unsigned> Hint = mri_->getRegAllocationHint(Reg);
if (Hint.first || Hint.second)
mri_->setRegAllocationHint(NewVReg, Hint.first, Hint.second);
}
if (!TryFold)

View File

@ -1,4 +1,4 @@
; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 59
; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 58
; PR2568
@g_3 = external global i16 ; <i16*> [#uses=1]