diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-10-26 23:23:35 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-10-26 23:23:35 +0000 |
commit | 3d7c780d93ebcb84a1224de8c44835ea43e82b15 (patch) | |
tree | e09f0b41899de083f34367ff644c4f0dbf279bc3 /lib/CodeGen | |
parent | 8c7a185dd84a7d44b1c83f66fd60629372efd498 (diff) |
Add missing safety check to an optimization for do-while loops. PR14191.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 7c65b3c437..5c1fea4472 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -237,6 +237,10 @@ void CodeGenFunction::SimplifyForwardingBlocks(llvm::BasicBlock *BB) { if (!BI || !BI->isUnconditional()) return; + // Can only simplify empty blocks. + if (BI != BB->begin()) + return; + BB->replaceAllUsesWith(BI->getSuccessor(0)); BI->eraseFromParent(); BB->eraseFromParent(); |