[llvm-commits] [llvm] r75423 - in /llvm/trunk/lib/CodeGen: IfConversion.cpp PreAllocSplitting.cpp RegisterScavenging.cpp SelectionDAG/SelectionDAGISel.cpp

Torok Edwin edwintorok at gmail.com
Sun Jul 12 13:07:01 PDT 2009


Author: edwin
Date: Sun Jul 12 15:07:01 2009
New Revision: 75423

URL: http://llvm.org/viewvc/llvm-project?rev=75423&view=rev
Log:
Fix assert(0) conversion, as suggested by Chris.

Modified:
    llvm/trunk/lib/CodeGen/IfConversion.cpp
    llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
    llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=75423&r1=75422&r2=75423&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Sun Jul 12 15:07:01 2009
@@ -1132,10 +1132,10 @@
     if (TII->isPredicated(I))
       continue;
     if (!TII->PredicateInstruction(I, Cond)) {
-      std::string msg;
-      raw_string_ostream Msg(msg);
-      Msg << "Unable to predicate " << *I << "!";
-      llvm_report_error(Msg.str());
+#ifndef NDEBUG
+      cerr << "Unable to predicate " << *I << "!\n";
+#endif
+      llvm_unreachable();
     }
   }
 
@@ -1168,10 +1168,10 @@
 
     if (!isPredicated)
       if (!TII->PredicateInstruction(MI, Cond)) {
-        std::string msg;
-        raw_string_ostream Msg(msg);
-        Msg << "Unable to predicate " << *MI << "!";
-        llvm_report_error(Msg.str());
+#ifndef NDEBUG
+        cerr << "Unable to predicate " << *I << "!\n";
+#endif
+        llvm_unreachable();
       }
   }
 

Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=75423&r1=75422&r2=75423&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Jul 12 15:07:01 2009
@@ -1035,10 +1035,7 @@
     CurrLI->FindLiveRangeContaining(LIs->getUseIndex(BarrierIdx));
   VNInfo *ValNo = LR->valno;
 
-  if (ValNo->isUnused()) {
-    // Defined by a dead def? How can this be?
-    LLVM_UNREACHABLE("Val# is defined by a dead def?");
-  }
+  assert(!ValNo->isUnused() && "Val# is defined by a dead def?");
 
   MachineInstr *DefMI = ValNo->isDefAccurate()
     ? LIs->getInstructionFromIndex(ValNo->def) : NULL;

Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=75423&r1=75422&r2=75423&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Sun Jul 12 15:07:01 2009
@@ -459,9 +459,8 @@
     Reg = Candidates.find_next(Reg);
   }
 
-  if (ScavengedReg != 0) {
-    LLVM_UNREACHABLE("Scavenger slot is live, unable to scavenge another register!");
-  }
+  assert(ScavengedReg == 0 && 
+         "Scavenger slot is live, unable to scavenge another register!");
 
   // Spill the scavenged register before I.
   TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC);

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=75423&r1=75422&r2=75423&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Jul 12 15:07:01 2009
@@ -152,9 +152,12 @@
 // basic blocks, and the scheduler passes ownership of it to this method.
 MachineBasicBlock *TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
                                                  MachineBasicBlock *MBB) const {
-  llvm_report_error("If a target marks an instruction with "
-                    "'usesCustomDAGSchedInserter', it must implement "
-                    "TargetLowering::EmitInstrWithCustomInserter!");
+#ifndef NDEBUG
+  cerr << "If a target marks an instruction with "
+          "'usesCustomDAGSchedInserter', it must implement "
+          "TargetLowering::EmitInstrWithCustomInserter!";
+#endif
+  llvm_unreachable();
   return 0;  
 }
 
@@ -831,8 +834,8 @@
               cerr << "FastISel miss: ";
               BI->dump();
             }
-            if (EnableFastISelAbort)
-              LLVM_UNREACHABLE("FastISel didn't handle a PHI in a successor");
+            assert(!EnableFastISelAbort && 
+                   "FastISel didn't handle a PHI in a successor");
             break;
           }
 





More information about the llvm-commits mailing list