mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 22:43:29 +00:00
Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
llvm-svn: 6901
This commit is contained in:
parent
63a6427f1a
commit
0903331006
@ -40,19 +40,26 @@ bool PromotePass::runOnFunction(Function &F) {
|
||||
|
||||
BasicBlock &BB = F.getEntryNode(); // Get the entry node for the function
|
||||
|
||||
// Find allocas that are safe to promote, by looking at all instructions in
|
||||
// the entry node
|
||||
for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
|
||||
if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) // Is it an alloca?
|
||||
if (isAllocaPromotable(AI, TD))
|
||||
Allocas.push_back(AI);
|
||||
bool Changed = false;
|
||||
|
||||
while (1) {
|
||||
Allocas.clear();
|
||||
|
||||
// Find allocas that are safe to promote, by looking at all instructions in
|
||||
// the entry node
|
||||
for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
|
||||
if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) // Is it an alloca?
|
||||
if (isAllocaPromotable(AI, TD))
|
||||
Allocas.push_back(AI);
|
||||
|
||||
if (Allocas.empty()) break;
|
||||
|
||||
if (!Allocas.empty()) {
|
||||
PromoteMemToReg(Allocas, getAnalysis<DominanceFrontier>(), TD);
|
||||
NumPromoted += Allocas.size();
|
||||
return true;
|
||||
Changed = true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return Changed;
|
||||
}
|
||||
|
||||
// createPromoteMemoryToRegister - Provide an entry point to create this pass.
|
||||
|
Loading…
Reference in New Issue
Block a user