mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-21 11:38:35 +00:00
When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
to increment NumLocalPromoted, and didn't actually delete the dead alloca, leading to an extra iteration of mem2reg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59a2837715
commit
7a5745b38c
@ -686,10 +686,10 @@ bool PromoteMem2Reg::PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI) {
|
||||
}
|
||||
|
||||
// After traversing the basic block, there should be no more uses of the
|
||||
// alloca, remove it now.
|
||||
// alloca: remove it now.
|
||||
assert(AI->use_empty() && "Uses of alloca from more than one BB??");
|
||||
if (AST) AST->deleteValue(AI);
|
||||
AI->getParent()->getInstList().erase(AI);
|
||||
AI->eraseFromParent();
|
||||
|
||||
++NumLocalPromoted;
|
||||
return false;
|
||||
@ -739,6 +739,17 @@ PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector<AllocaInst*> &AIs) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At the end of the block scan, all allocas in CurValues are dead.
|
||||
for (DenseMap<AllocaInst*, Value*>::iterator I = CurValues.begin(),
|
||||
E = CurValues.end(); I != E; ++I) {
|
||||
AllocaInst *AI = I->first;
|
||||
assert(AI->use_empty() && "Uses of alloca from more than one BB??");
|
||||
if (AST) AST->deleteValue(AI);
|
||||
AI->eraseFromParent();
|
||||
}
|
||||
|
||||
NumLocalPromoted += CurValues.size();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user