summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-30 22:55:54 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-30 22:55:54 +0000
commit020d8d4c631a16fa797dc233655442c6cadd63cf (patch)
tree895df9bffbe94532162ba80a0f4296d86f2814b1
parent132f3133ae348126993979867cf58de673016d4a (diff)
downloadbcm5719-llvm-020d8d4c631a16fa797dc233655442c6cadd63cf.tar.gz
bcm5719-llvm-020d8d4c631a16fa797dc233655442c6cadd63cf.zip
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
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp6
-rw-r--r--llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll2
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 4412c1b020a..24adf364e71 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -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)
diff --git a/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll b/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
index 1d166f48815..67e14ffae5e 100644
--- a/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
+++ b/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
@@ -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]
OpenPOWER on IntegriCloud