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 | fc5b2effcf0e37e9aec1dc2a40b07989ae5b9a00 (patch) | |
tree | d5f30e99eebfd94fa109cd958cc4e2e3b6767290 /clang/lib/CodeGen/CGStmt.cpp | |
parent | a7137bc1c2eb8d4347e2de51fc7dd206029286a5 (diff) | |
download | bcm5719-llvm-fc5b2effcf0e37e9aec1dc2a40b07989ae5b9a00.tar.gz bcm5719-llvm-fc5b2effcf0e37e9aec1dc2a40b07989ae5b9a00.zip |
Add missing safety check to an optimization for do-while loops. PR14191.
llvm-svn: 166832
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 7c65b3c4376..5c1fea4472f 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/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(); |