Renumber slot indexes uniformly instead of spacing according to the number of defs.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 3 Mar 2011 06:29:01 +0000 (06:29 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 3 Mar 2011 06:29:01 +0000 (06:29 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126926 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SlotIndexes.cpp

index f18854be856d370bf05996f79c12417e8882fd1a..73adb92101d7447e5283e1c6f40cbfc0d5b5f939 100644 (file)
@@ -129,26 +129,12 @@ void SlotIndexes::renumberIndexes() {
   // 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;
   }
 }