Do not rely on std::sort and std::erase to get list of unique

exit blocks. The output is dependent on addresses of basic block.

Add and use Loop::getUniqueExitBlocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29966 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2006-08-29 22:29:16 +00:00
parent c9676deb23
commit 4b8f36f106
3 changed files with 63 additions and 10 deletions

View File

@ -570,11 +570,8 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
std::vector<BasicBlock*> ExitBlocks;
L->getExitBlocks(ExitBlocks);
std::sort(ExitBlocks.begin(), ExitBlocks.end());
ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()),
ExitBlocks.end());
L->getUniqueExitBlocks(ExitBlocks);
// Split all of the edges from inside the loop to their exit blocks. Update
// the appropriate Phi nodes as we do so.
unsigned NumBlocks = L->getBlocks().size();
@ -626,11 +623,8 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// The exit blocks may have been changed due to edge splitting, recompute.
ExitBlocks.clear();
L->getExitBlocks(ExitBlocks);
std::sort(ExitBlocks.begin(), ExitBlocks.end());
ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()),
ExitBlocks.end());
L->getUniqueExitBlocks(ExitBlocks);
// Add exit blocks to the loop blocks.
LoopBlocks.insert(LoopBlocks.end(), ExitBlocks.begin(), ExitBlocks.end());