Set an allocation hint when rematting before a COPY.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 9 Feb 2011 00:25:36 +0000 (00:25 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 9 Feb 2011 00:25:36 +0000 (00:25 +0000)
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

lib/CodeGen/InlineSpiller.cpp

index 00ca3d5bb64d35752d0d6e88f021c09293da8078..a1bd972d38e25a276377484aab9fe84c708d9073 100644 (file)
@@ -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_);