Эх сурвалжийг харах

LiveVariables: Do not remove dead flags from vreg operands

Also add a FIXME comment on why Mips RDDSP causes bogus dead flags to be
added which LiveVariables cleans up by accident.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264695 91177308-0d34-0410-b5e6-96231b3b80d8
Matthias Braun 9 жил өмнө
parent
commit
031bfc2498

+ 8 - 3
lib/CodeGen/LiveVariables.cpp

@@ -527,9 +527,14 @@ void LiveVariables::runOnInstr(MachineInstr *MI,
         MO.setIsKill(false);
       if (MO.readsReg())
         UseRegs.push_back(MOReg);
-    } else /*MO.isDef()*/ {
-      if (!(TargetRegisterInfo::isPhysicalRegister(MOReg) &&
-            MRI->isReserved(MOReg)))
+    } else {
+      assert(MO.isDef());
+      // FIXME: We should not remove any dead flags. Howeve the MIPS RDDSP
+      // instruction needs it at the moment: RDDSP gets its implicit use
+      // operands added too late in the processing so InstrEmitter adds an
+      // incorrect dead flag because the uses are not yet visible.
+      if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
+          !MRI->isReserved(MOReg))
         MO.setIsDead(false);
       DefRegs.push_back(MOReg);
     }