summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-06-21 18:33:26 +0000
committerAndrew Trick <atrick@apple.com>2013-06-21 18:33:26 +0000
commit5749b8be01e33db68f5ad69541b2288553b53aa7 (patch)
tree7810b945bbaa11a1d03cfe8fe3b8acabc4ab469f /llvm/lib/CodeGen
parent8d02e917f451a3e93ee91bdb2cdc6bdaf119c619 (diff)
downloadbcm5719-llvm-5749b8be01e33db68f5ad69541b2288553b53aa7.tar.gz
bcm5719-llvm-5749b8be01e33db68f5ad69541b2288553b53aa7.zip
Update physreg live intervals during remat.
llvm-svn: 184574
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/InlineSpiller.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index db63b526383..2ab58a721ba 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -1054,6 +1054,34 @@ foldMemoryOperand(ArrayRef<std::pair<MachineInstr*, unsigned> > Ops,
: TII.foldMemoryOperand(MI, FoldOps, StackSlot);
if (!FoldMI)
return false;
+
+ // Remove LIS for any dead defs in the original MI not in FoldMI.
+ for (MIBundleOperands MO(MI); MO.isValid(); ++MO) {
+ if (!MO->isReg())
+ continue;
+ unsigned Reg = MO->getReg();
+ if (!Reg || TargetRegisterInfo::isVirtualRegister(Reg) ||
+ MRI.isReserved(Reg)) {
+ continue;
+ }
+ MIBundleOperands::PhysRegInfo RI =
+ MIBundleOperands(FoldMI).analyzePhysReg(Reg, &TRI);
+ if (MO->readsReg()) {
+ assert(RI.Reads && "Cannot fold physreg reader");
+ continue;
+ }
+ if (RI.Defines)
+ continue;
+ // FoldMI does not define this physreg. Remove the LI segment.
+ assert(MO->isDead() && "Cannot fold physreg def");
+ for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units) {
+ if (LiveInterval *LI = LIS.getCachedRegUnit(*Units)) {
+ SlotIndex Idx = LIS.getInstructionIndex(MI).getRegSlot();
+ if (VNInfo *VNI = LI->getVNInfoAt(Idx))
+ LI->removeValNo(VNI);
+ }
+ }
+ }
LIS.ReplaceMachineInstrInMaps(MI, FoldMI);
MI->eraseFromParent();
OpenPOWER on IntegriCloud