Changed my mind. We now allow remat of instructions whose defs have subreg indices.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 16 Jul 2009 20:15:00 +0000 (20:15 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 16 Jul 2009 20:15:00 +0000 (20:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76100 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/VirtRegRewriter.cpp
test/CodeGen/X86/2008-08-23-X86-64AsmBug.ll

index 873e58e5c7b3a42621a98969a6e1bbaf8c4bccd2..d8f2089f31a9336ea23e472f0616fcd89dffaccc 100644 (file)
@@ -1157,11 +1157,6 @@ bool LiveIntervals::isReMaterializable(const LiveInterval &li,
   if (DisableReMat)
     return false;
 
-  // FIXME: For now, avoid remating instructions whose definition has a subreg
-  // index. It's just incredibly difficult to get right.
-  if (MI->findRegisterDefOperand(li.reg)->getSubReg())
-    return false;
-
   if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF)
     return true;
 
index 800cdd625f9e5855aeaf0b116e19dd4bf394d5e0..a859d80e1b732f6cc6dad3aa91c0cb3656e2395f 100644 (file)
@@ -490,7 +490,14 @@ static void ReMaterialize(MachineBasicBlock &MBB,
                           const TargetInstrInfo *TII,
                           const TargetRegisterInfo *TRI,
                           VirtRegMap &VRM) {
-  TII->reMaterialize(MBB, MII, DestReg, 0, VRM.getReMaterializedMI(Reg));
+  MachineInstr *ReMatDefMI = VRM.getReMaterializedMI(Reg);
+#ifdef NDEBUG
+  const TargetInstrDesc &TID = ReMatDefMI->getDesc();
+  assert(TID.getNumDefs() != 1 &&
+         "Don't know how to remat instructions that define > 1 values!");
+#endif
+  TII->reMaterialize(MBB, MII, DestReg,
+                     ReMatDefMI->getOperand(0).getSubReg(), ReMatDefMI);
   MachineInstr *NewMI = prior(MII);
   for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
     MachineOperand &MO = NewMI->getOperand(i);
index 518e8ccd5dc1eb90252f1a020ec41226c6836b42..a0f4fcf22a9a502d6c6544c6da2504e2d6ab6177 100644 (file)
@@ -1,10 +1,7 @@
+; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movd | count 1
 ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movq
 ; PR2677
 
-; FIXME: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep movd | count 1
-; We now no longer allow instruction whose def has a sub-reg index to be
-; rematerialized.
-
 
        %struct.Bigint = type { %struct.Bigint*, i32, i32, i32, i32, [1 x i32] }