diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-20 05:44:58 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-20 05:44:58 +0000 |
| commit | e55003fb04959c7b11d5d5d1b51322bf9e89fb76 (patch) | |
| tree | 21a3f6800b9f78f9281fda3d40202dc88ad29d8e /llvm/lib/CodeGen | |
| parent | 39488642d32f476992078d58e00f22fe294d686f (diff) | |
| download | bcm5719-llvm-e55003fb04959c7b11d5d5d1b51322bf9e89fb76.tar.gz bcm5719-llvm-e55003fb04959c7b11d5d5d1b51322bf9e89fb76.zip | |
Also eliminate redundant spills downstream of inserted reloads.
This can happen when multiple sibling registers are spilled after live range
splitting.
llvm-svn: 127965
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/InlineSpiller.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp index 3e2adfbe24b..78a6ca62d93 100644 --- a/llvm/lib/CodeGen/InlineSpiller.cpp +++ b/llvm/lib/CodeGen/InlineSpiller.cpp @@ -466,6 +466,7 @@ bool InlineSpiller::hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI) { /// eliminateRedundantSpills - SLI:VNI is known to be on the stack. Remove any /// redundant spills of this value in SLI.reg and sibling copies. void InlineSpiller::eliminateRedundantSpills(LiveInterval &SLI, VNInfo *VNI) { + assert(VNI && "Missing value"); SmallVector<std::pair<LiveInterval*, VNInfo*>, 8> WorkList; WorkList.push_back(std::make_pair(&SLI, VNI)); LiveInterval &StackInt = LSS.getInterval(StackSlot); @@ -793,15 +794,22 @@ void InlineSpiller::spillAroundUses(unsigned Reg) { // Check for a sibling copy. unsigned SibReg = isFullCopyOf(MI, Reg); - if (!isSibling(SibReg)) - SibReg = 0; - - // Hoist the spill of a sib-reg copy. - if (SibReg && Writes && !Reads && hoistSpill(OldLI, MI)) { - // This COPY is now dead, the value is already in the stack slot. - MI->getOperand(0).setIsDead(); - DeadDefs.push_back(MI); - continue; + if (SibReg && isSibling(SibReg)) { + if (Writes) { + // Hoist the spill of a sib-reg copy. + if (hoistSpill(OldLI, MI)) { + // This COPY is now dead, the value is already in the stack slot. + MI->getOperand(0).setIsDead(); + DeadDefs.push_back(MI); + continue; + } + } else { + // This is a reload for a sib-reg copy. Drop spills downstream. + SlotIndex Idx = LIS.getInstructionIndex(MI).getDefIndex(); + LiveInterval &SibLI = LIS.getInterval(SibReg); + eliminateRedundantSpills(SibLI, SibLI.getVNInfoAt(Idx)); + // The COPY will fold to a reload below. + } } // Attempt to fold memory ops. |

