diff options
author | Devang Patel <dpatel@apple.com> | 2006-08-29 22:29:16 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-08-29 22:29:16 +0000 |
commit | 4b8f36f10672bbdd747eabfb5708e4758c3d5337 (patch) | |
tree | 45f280ff989c8ff3e19e87f6a1554f5b67b40060 /lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | c9676deb23c63a932838d2e4995d05179217db06 (diff) |
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
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 9c3655205b..ea643b698e 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -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()); |