[llvm-commits] [llvm] r126926 - /llvm/trunk/lib/CodeGen/SlotIndexes.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Mar 2 22:29:01 PST 2011


Author: stoklund
Date: Thu Mar  3 00:29:01 2011
New Revision: 126926

URL: http://llvm.org/viewvc/llvm-project?rev=126926&view=rev
Log:
Renumber slot indexes uniformly instead of spacing according to the number of defs.

There are probably much larger speedups to be had by renumbering locally instead
of looping over the whole function. For now, the greedy register allocator is
25% faster.

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

Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=126926&r1=126925&r2=126926&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Thu Mar  3 00:29:01 2011
@@ -129,26 +129,12 @@
   // had been present.
   DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n");
 
-  functionSize = 0;
   unsigned index = 0;
 
   for (IndexListEntry *curEntry = front(); curEntry != getTail();
        curEntry = curEntry->getNext()) {
-
     curEntry->setIndex(index);
-
-    if (curEntry->getInstr() == 0) {
-      // MBB start entry. Just step index by 1.
-      index += SlotIndex::NUM;
-    }
-    else {
-      ++functionSize;
-      unsigned Slots = curEntry->getInstr()->getDesc().getNumDefs();
-      if (Slots == 0)
-        Slots = 1;
-
-      index += (Slots + 1) * SlotIndex::NUM;
-    }
+    index += 4*SlotIndex::NUM;
   }
 }
 





More information about the llvm-commits mailing list