[llvm-commits] [llvm] r124838 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Feb 3 16:39:18 PST 2011


Author: stoklund
Date: Thu Feb  3 18:39:18 2011
New Revision: 124838

URL: http://llvm.org/viewvc/llvm-project?rev=124838&view=rev
Log:
Verify kill flags conservatively.

Allow a live range to end with a kill flag, but don't allow a kill flag that
doesn't end the live range.

This makes the machine code verifier more useful during register allocation when
kill flag computation is deferred.

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=124838&r1=124837&r2=124838&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Thu Feb  3 18:39:18 2011
@@ -647,24 +647,11 @@
             report("No live range at use", MO, MONum);
             *OS << UseIdx << " is not live in " << LI << '\n';
           }
-          // Verify isKill == LI.killedAt.
-          // Two-address instrs don't have kill flags on the tied operands, and
-          // we even allow
-          //   %r1 = add %r1, %r1
-          // without a kill flag on the untied operand.
-          // MI->findRegisterUseOperandIdx finds the first operand using reg.
-          if (!MI->isRegTiedToDefOperand(MI->findRegisterUseOperandIdx(Reg))) {
-            // MI could kill register without a kill flag on MO.
-            bool miKill = MI->killsRegister(Reg);
-            bool liKill = LI.killedAt(UseIdx.getDefIndex());
-            if (miKill && !liKill) {
-              report("Live range continues after kill flag", MO, MONum);
-              *OS << "Live range: " << LI << '\n';
-            }
-            if (!miKill && liKill) {
-              report("Live range ends without kill flag", MO, MONum);
-              *OS << "Live range: " << LI << '\n';
-            }
+          // Check for extra kill flags.
+          // Note that we allow missing kill flags for now.
+          if (MO->isKill() && !LI.killedAt(UseIdx.getDefIndex())) {
+            report("Live range continues after kill flag", MO, MONum);
+            *OS << "Live range: " << LI << '\n';
           }
         } else {
           report("Virtual register has no Live interval", MO, MONum);





More information about the llvm-commits mailing list