aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-09 00:25:36 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-09 00:25:36 +0000
commitc3dca3f9d4a049102fa985aedbc65e53f4cf6c0d (patch)
tree2f83006f939c37553916f267cc8a5199a20ea5e0
parent8a2bbdeee24b40da6187199658646d04329c139e (diff)
Set an allocation hint when rematting before a COPY.
This almost guarantees that the COPY will be coalesced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125140 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/InlineSpiller.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp
index 00ca3d5bb6..a1bd972d38 100644
--- a/lib/CodeGen/InlineSpiller.cpp
+++ b/lib/CodeGen/InlineSpiller.cpp
@@ -154,6 +154,10 @@ bool InlineSpiller::reMaterializeFor(MachineBasicBlock::iterator MI) {
LiveInterval &NewLI = edit_->create(mri_, lis_, vrm_);
NewLI.markNotSpillable();
+ // Rematting for a copy: Set allocation hint to be the destination register.
+ if (MI->isCopy())
+ mri_.setRegAllocationHint(NewLI.reg, 0, MI->getOperand(0).getReg());
+
// Finally we can rematerialize OrigMI before MI.
SlotIndex DefIdx = edit_->rematerializeAt(*MI->getParent(), MI, NewLI.reg, RM,
lis_, tii_, tri_);