[llvm] r184574 - Update physreg live intervals during remat.
Andrew Trick
atrick at apple.com
Fri Jun 21 11:33:26 PDT 2013
Author: atrick
Date: Fri Jun 21 13:33:26 2013
New Revision: 184574
URL: http://llvm.org/viewvc/llvm-project?rev=184574&view=rev
Log:
Update physreg live intervals during remat.
Modified:
llvm/trunk/lib/CodeGen/InlineSpiller.cpp
llvm/trunk/test/CodeGen/X86/crash.ll
Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=184574&r1=184573&r2=184574&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Fri Jun 21 13:33:26 2013
@@ -1054,6 +1054,34 @@ foldMemoryOperand(ArrayRef<std::pair<Mac
: 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();
Modified: llvm/trunk/test/CodeGen/X86/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/crash.ll?rev=184574&r1=184573&r2=184574&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/crash.ll (original)
+++ llvm/trunk/test/CodeGen/X86/crash.ll Fri Jun 21 13:33:26 2013
@@ -1,5 +1,5 @@
-; RUN: llc -march=x86 < %s -verify-machineinstrs
-; RUN: llc -march=x86-64 < %s -verify-machineinstrs
+; RUN: llc -march=x86 < %s -verify-machineinstrs -precompute-phys-liveness
+; RUN: llc -march=x86-64 < %s -verify-machineinstrs -precompute-phys-liveness
; PR6497
@@ -107,8 +107,8 @@ do.body92:
ret void
}
-!0 = metadata !{i32 633550}
-!1 = metadata !{i32 634261}
+!0 = metadata !{i32 633550}
+!1 = metadata !{i32 634261}
; Crash during XOR optimization.
More information about the llvm-commits
mailing list