[llvm] r264769 - MachineVerifier: On dead-def live segments, check that corresponding machine operand has a dead flag

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 12:07:43 PDT 2016


Author: matze
Date: Tue Mar 29 14:07:43 2016
New Revision: 264769

URL: http://llvm.org/viewvc/llvm-project?rev=264769&view=rev
Log:
MachineVerifier: On dead-def live segments, check that corresponding machine operand has a dead flag

Modified:
    llvm/trunk/lib/CodeGen/MachineVerifier.cpp

Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=264769&r1=264768&r2=264769&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Tue Mar 29 14:07:43 2016
@@ -1743,18 +1743,33 @@ void MachineVerifier::verifyLiveRangeSeg
     // use, or a dead flag on a def.
     bool hasRead = false;
     bool hasSubRegDef = false;
+    bool hasDeadDef = false;
     for (ConstMIBundleOperands MOI(*MI); MOI.isValid(); ++MOI) {
       if (!MOI->isReg() || MOI->getReg() != Reg)
         continue;
       if (LaneMask != 0 &&
           (LaneMask & TRI->getSubRegIndexLaneMask(MOI->getSubReg())) == 0)
         continue;
-      if (MOI->isDef() && MOI->getSubReg() != 0)
-        hasSubRegDef = true;
+      if (MOI->isDef()) {
+        if (MOI->getSubReg() != 0)
+          hasSubRegDef = true;
+        if (MOI->isDead())
+          hasDeadDef = true;
+      }
       if (MOI->readsReg())
         hasRead = true;
     }
-    if (!S.end.isDead()) {
+    if (S.end.isDead()) {
+      // Make sure that the corresponding machine operand for a "dead" live
+      // range has the dead flag. We cannot perform this check for subregister
+      // liveranges as partially dead values are allowed.
+      if (LaneMask == 0 && !hasDeadDef) {
+        report("Instruction ending live segment on dead slot has no dead flag",
+               MI);
+        report_context(LR, Reg, LaneMask);
+        report_context(S);
+      }
+    } else {
       if (!hasRead) {
         // When tracking subregister liveness, the main range must start new
         // values on partial register writes, even if there is no read.




More information about the llvm-commits mailing list