Skip to content
Snippets Groups Projects
Commit bf67b122 authored by Chris Lattner's avatar Chris Lattner
Browse files

Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::erase

bug is fixed.

llvm-svn: 33932
parent 92c5d118
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,7 @@ namespace { ...@@ -115,7 +115,7 @@ namespace {
private: private:
void MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum, void MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum,
std::set<PHINode*> &DeadPHINodes); SmallPtrSet<PHINode*, 16> &DeadPHINodes);
bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI); bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI);
void PromoteLocallyUsedAllocas(BasicBlock *BB, void PromoteLocallyUsedAllocas(BasicBlock *BB,
const std::vector<AllocaInst*> &AIs); const std::vector<AllocaInst*> &AIs);
...@@ -123,7 +123,7 @@ namespace { ...@@ -123,7 +123,7 @@ namespace {
void RenamePass(BasicBlock *BB, BasicBlock *Pred, void RenamePass(BasicBlock *BB, BasicBlock *Pred,
std::vector<Value*> &IncVals); std::vector<Value*> &IncVals);
bool QueuePhiNode(BasicBlock *BB, unsigned AllocaIdx, unsigned &Version, bool QueuePhiNode(BasicBlock *BB, unsigned AllocaIdx, unsigned &Version,
std::set<PHINode*> &InsertedPHINodes); SmallPtrSet<PHINode*, 16> &InsertedPHINodes);
}; };
} // end of anonymous namespace } // end of anonymous namespace
...@@ -271,7 +271,7 @@ void PromoteMem2Reg::run() { ...@@ -271,7 +271,7 @@ void PromoteMem2Reg::run() {
// dominance frontier of EACH basic-block we have a write in. // dominance frontier of EACH basic-block we have a write in.
// //
unsigned CurrentVersion = 0; unsigned CurrentVersion = 0;
std::set<PHINode*> InsertedPHINodes; SmallPtrSet<PHINode*, 16> InsertedPHINodes;
std::vector<unsigned> DFBlocks; std::vector<unsigned> DFBlocks;
while (!DefiningBlocks.empty()) { while (!DefiningBlocks.empty()) {
BasicBlock *BB = DefiningBlocks.back(); BasicBlock *BB = DefiningBlocks.back();
...@@ -315,7 +315,7 @@ void PromoteMem2Reg::run() { ...@@ -315,7 +315,7 @@ void PromoteMem2Reg::run() {
UsingBlocks.clear(); UsingBlocks.clear();
// If there are any PHI nodes which are now known to be dead, remove them! // If there are any PHI nodes which are now known to be dead, remove them!
for (std::set<PHINode*>::iterator I = InsertedPHINodes.begin(), for (SmallPtrSet<PHINode*, 16>::iterator I = InsertedPHINodes.begin(),
E = InsertedPHINodes.end(); I != E; ++I) { E = InsertedPHINodes.end(); I != E; ++I) {
PHINode *PN = *I; PHINode *PN = *I;
std::vector<PHINode*> &BBPNs = NewPhiNodes[PN->getParent()]; std::vector<PHINode*> &BBPNs = NewPhiNodes[PN->getParent()];
...@@ -489,7 +489,7 @@ void PromoteMem2Reg::run() { ...@@ -489,7 +489,7 @@ void PromoteMem2Reg::run() {
// DeadPHINodes set are removed. // DeadPHINodes set are removed.
// //
void PromoteMem2Reg::MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum, void PromoteMem2Reg::MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum,
std::set<PHINode*> &DeadPHINodes) { SmallPtrSet<PHINode*, 16> &DeadPHINodes) {
// Scan the immediate dominators of this block looking for a block which has a // Scan the immediate dominators of this block looking for a block which has a
// PHI node for Alloca num. If we find it, mark the PHI node as being alive! // PHI node for Alloca num. If we find it, mark the PHI node as being alive!
for (DominatorTree::Node *N = DT[BB]; N; N = N->getIDom()) { for (DominatorTree::Node *N = DT[BB]; N; N = N->getIDom()) {
...@@ -630,7 +630,7 @@ PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector<AllocaInst*> &AIs) { ...@@ -630,7 +630,7 @@ PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector<AllocaInst*> &AIs) {
// //
bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo, bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo,
unsigned &Version, unsigned &Version,
std::set<PHINode*> &InsertedPHINodes) { SmallPtrSet<PHINode*, 16> &InsertedPHINodes) {
// Look up the basic-block in question. // Look up the basic-block in question.
std::vector<PHINode*> &BBPNs = NewPhiNodes[BB]; std::vector<PHINode*> &BBPNs = NewPhiNodes[BB];
if (BBPNs.empty()) BBPNs.resize(Allocas.size()); if (BBPNs.empty()) BBPNs.resize(Allocas.size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment