diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-14 00:29:42 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-14 00:29:42 +0000 |
commit | 4a63fad976c8cf3bcdc1bbc3927668164890ecb8 (patch) | |
tree | e6591471e46231800e73582000d2b83f65c0e505 /llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | |
parent | a030fa529701850bc299a486b05e8f1bd4911ada (diff) | |
download | bcm5719-llvm-4a63fad976c8cf3bcdc1bbc3927668164890ecb8.tar.gz bcm5719-llvm-4a63fad976c8cf3bcdc1bbc3927668164890ecb8.zip |
Teach SimplifyCFG how to simplify indirectbr instructions.
- Eliminate redundant successors.
- Convert an indirectbr with one successor into a direct branch.
Also, generalize SimplifyCFG to be able to be run on a function entry block.
It knows quite a few simplifications which are applicable to the entry
block, and it only needs a few checks to avoid trouble with the entry block.
llvm-svn: 111060
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index df6ef2ee75b..360749caf11 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -285,10 +285,9 @@ static bool IterativeSimplifyCFG(Function &F, const TargetData *TD) { while (LocalChange) { LocalChange = false; - // Loop over all of the basic blocks (except the first one) and remove them - // if they are unneeded... + // Loop over all of the basic blocks and remove them if they are unneeded... // - for (Function::iterator BBIt = ++F.begin(); BBIt != F.end(); ) { + for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) { if (SimplifyCFG(BBIt++, TD)) { LocalChange = true; ++NumSimpl; |