[llvm-commits] [llvm] r119963 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Duncan Sands baldrick at free.fr
Mon Nov 22 01:41:24 PST 2010


Author: baldrick
Date: Mon Nov 22 03:41:24 2010
New Revision: 119963

URL: http://llvm.org/viewvc/llvm-project?rev=119963&view=rev
Log:
Don't keep track of inserted phis in PromoteMemoryToRegister: the information
is never used.  Patch by Cameron Zwarich.

Modified:
    llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=119963&r1=119962&r2=119963&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Nov 22 03:41:24 2010
@@ -265,8 +265,7 @@
     void RenamePass(BasicBlock *BB, BasicBlock *Pred,
                     RenamePassData::ValVector &IncVals,
                     std::vector<RenamePassData> &Worklist);
-    bool QueuePhiNode(BasicBlock *BB, unsigned AllocaIdx, unsigned &Version,
-                      SmallPtrSet<PHINode*, 16> &InsertedPHINodes);
+    bool QueuePhiNode(BasicBlock *BB, unsigned AllocaIdx, unsigned &Version);
   };
   
   struct AllocaInfo {
@@ -677,7 +676,6 @@
   // Compute the locations where PhiNodes need to be inserted.  Look at the
   // dominance frontier of EACH basic-block we have a write in.
   unsigned CurrentVersion = 0;
-  SmallPtrSet<PHINode*, 16> InsertedPHINodes;
   std::vector<std::pair<unsigned, BasicBlock*> > DFBlocks;
   while (!Info.DefiningBlocks.empty()) {
     BasicBlock *BB = Info.DefiningBlocks.back();
@@ -710,7 +708,7 @@
     
     for (unsigned i = 0, e = DFBlocks.size(); i != e; ++i) {
       BasicBlock *BB = DFBlocks[i].second;
-      if (QueuePhiNode(BB, AllocaNum, CurrentVersion, InsertedPHINodes))
+      if (QueuePhiNode(BB, AllocaNum, CurrentVersion))
         Info.DefiningBlocks.push_back(BB);
     }
     DFBlocks.clear();
@@ -901,8 +899,7 @@
 // Alloca returns true if there wasn't already a phi-node for that variable
 //
 bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo,
-                                  unsigned &Version,
-                                  SmallPtrSet<PHINode*, 16> &InsertedPHINodes) {
+                                  unsigned &Version) {
   // Look up the basic-block in question.
   PHINode *&PN = NewPhiNodes[std::make_pair(BB, AllocaNo)];
 
@@ -917,8 +914,6 @@
   ++NumPHIInsert;
   PhiToAllocaMap[PN] = AllocaNo;
   PN->reserveOperandSpace(getNumPreds(BB));
-  
-  InsertedPHINodes.insert(PN);
 
   if (AST && PN->getType()->isPointerTy())
     AST->copyValue(PointerAllocaValues[AllocaNo], PN);





More information about the llvm-commits mailing list