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

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jul 15 16:37:36 PDT 2009


Author: stoklund
Date: Wed Jul 15 18:37:26 2009
New Revision: 75860

URL: http://llvm.org/viewvc/llvm-project?rev=75860&view=rev
Log:
Verify that there is no kill flag on tied operands on two-address instructions.
This extra check is not trigged when runnning "make check" on top-of-tree.

Change error message to better match llvm_unreachable() grammar.

Don't call llvm_unreachable() when writing error messages to a file, but keep going.

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=75860&r1=75859&r2=75860&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Wed Jul 15 18:37:26 2009
@@ -219,11 +219,10 @@
 
   if (OutFileName)
     OutFile.close();
-
-  if (foundErrors) {
+  else if (foundErrors) {
     std::string msg;
     raw_string_ostream Msg(msg);
-    Msg << "\nStopping with " << foundErrors << " machine code errors.";
+    Msg << "Found " << foundErrors << " machine code errors.";
     llvm_report_error(Msg.str());
   }
 
@@ -353,8 +352,12 @@
     if (MO->isUse()) {
       if (MO->isKill()) {
         addRegWithSubRegs(regsKilled, Reg);
+        // Tied operands on two-address instuctions MUST NOT have a <kill> flag.
+        if (MI->isRegTiedToDefOperand(MONum))
+            report("Illegal kill flag on two-address instruction operand",
+                   MO, MONum);
       } else {
-        // TwoAddress instr modyfying a reg is treated as kill+def.
+        // TwoAddress instr modifying a reg is treated as kill+def.
         unsigned defIdx;
         if (MI->isRegTiedToDefOperand(MONum, &defIdx) &&
             MI->getOperand(defIdx).getReg() == Reg)





More information about the llvm-commits mailing list