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 | f489d0f85c4a90769df6cd6cf86173a5f1826ddc (patch) | |
| tree | 6b49b902995eb081b8f9e287a486dc99f5782f34 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | |
| parent | 6d464146d0c545d339b49124828be92b51fc648f (diff) | |
| download | bcm5719-llvm-f489d0f85c4a90769df6cd6cf86173a5f1826ddc.tar.gz bcm5719-llvm-f489d0f85c4a90769df6cd6cf86173a5f1826ddc.zip | |
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.
llvm-svn: 29966
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 9c3655205b5..ea643b698ed 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/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()); |

