[llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Thu Jul 29 14:31:30 PDT 2004



Changes in directory llvm/lib/CodeGen/InstrSched:

InstrScheduling.cpp updated: 1.74 -> 1.75

---
Log message:

Convert a few assertions with side-effects into regular old runtime checks.
These side-effects seem to make a difference when using llc -march=sparcv9
in Release mode (i.e., with -DNDEBUG); when they are left out, lots of
instructions just get dropped on the floor, because they never end up
in the schedule.


---
Diffs of the changes:  (+8 -5)

Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp
diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.74 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.75
--- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.74	Wed Jul 28 14:24:48 2004
+++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp	Thu Jul 29 16:31:20 2004
@@ -193,7 +193,10 @@
 					 unsigned int slotNum,
 					 cycles_t cycle) {
     InstrGroup* igroup = this->getIGroup(cycle);
-    assert((*igroup)[slotNum] == NULL &&  "Slot already filled?");
+    if (!((*igroup)[slotNum] == NULL)) {
+      std::cerr << "Slot already filled?\n";
+      abort();
+    }
     igroup->addInstr(node, slotNum);
     assert(node->getNodeId() < startTime.size());
     startTime[node->getNodeId()] = cycle;
@@ -626,7 +629,6 @@
 {
   const TargetInstrInfo& mii = S.schedInfo.getInstrInfo();
   
-#ifndef NDEBUG
   // Lets make sure we didn't lose any instructions, except possibly
   // some NOPs from delay slots.  Also, PHIs are not included in the schedule.
   unsigned numInstr = 0;
@@ -636,7 +638,6 @@
       ++numInstr;
   assert(S.isched.getNumInstructions() >= numInstr &&
 	 "Lost some non-NOP instructions during scheduling!");
-#endif
   
   if (S.isched.getNumInstructions() == 0)
     return;				// empty basic block!
@@ -1174,8 +1175,10 @@
   MachineBasicBlock& MBB = node->getMachineBasicBlock();
   MachineBasicBlock::iterator MBBI = MBB.begin();
   std::advance(MBBI, firstDelaySlotIdx - 1);
-  assert(&*MBBI++ == brInstr &&
-         "Incorrect instr. index in basic block for brInstr");
+  if (!(&*MBBI++ == brInstr)) {
+    std::cerr << "Incorrect instr. index in basic block for brInstr";
+    abort();
+  }
   
   // First find all useful instructions already in the delay slots
   // and USE THEM.  We'll throw away the unused alternatives below





More information about the llvm-commits mailing list