[llvm-commits] CVS: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Chris Lattner sabre at nondot.org
Mon Feb 5 15:31:42 PST 2007



Changes in directory llvm/lib/Transforms/Utils:

PromoteMemoryToRegister.cpp updated: 1.90 -> 1.91
---
Log message:

Simplify use of DFBlocks, this makes no noticable performance difference,
but paves the way to eliminate BBNumbers.


---
Diffs of the changes:  (+3 -3)

 PromoteMemoryToRegister.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.90 llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.91
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.90	Mon Feb  5 17:11:37 2007
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp	Mon Feb  5 17:31:26 2007
@@ -272,7 +272,7 @@
     //
     unsigned CurrentVersion = 0;
     SmallPtrSet<PHINode*, 16> InsertedPHINodes;
-    std::vector<unsigned> DFBlocks;
+    std::vector<std::pair<unsigned, BasicBlock*> > DFBlocks;
     while (!DefiningBlocks.empty()) {
       BasicBlock *BB = DefiningBlocks.back();
       DefiningBlocks.pop_back();
@@ -289,13 +289,13 @@
         // processing blocks in order of the occurance in the function.
         for (DominanceFrontier::DomSetType::const_iterator P = S.begin(),
              PE = S.end(); P != PE; ++P)
-          DFBlocks.push_back(BBNumbers.getNumber(*P));
+          DFBlocks.push_back(std::make_pair(BBNumbers.getNumber(*P), *P));
 
         // Sort by which the block ordering in the function.
         std::sort(DFBlocks.begin(), DFBlocks.end());
 
         for (unsigned i = 0, e = DFBlocks.size(); i != e; ++i) {
-          BasicBlock *BB = BBNumbers.getBlock(DFBlocks[i]);
+          BasicBlock *BB = DFBlocks[i].second;
           if (QueuePhiNode(BB, AllocaNum, CurrentVersion, InsertedPHINodes))
             DefiningBlocks.push_back(BB);
         }






More information about the llvm-commits mailing list