summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-11 07:41:27 +0000
committerChris Lattner <sabre@nondot.org>2008-11-11 07:41:27 +0000
commit0946ccd1e58c1f1da31ddbca67c5b6301ac8b255 (patch)
tree6fd965047db26d94f85f159238d0bcf5801cb806 /lib/CodeGen/CGStmt.cpp
parent62b72f642207ba2ba433d686df924dc9594e9897 (diff)
downloadclang-0946ccd1e58c1f1da31ddbca67c5b6301ac8b255.tar.gz
clang-0946ccd1e58c1f1da31ddbca67c5b6301ac8b255.tar.bz2
clang-0946ccd1e58c1f1da31ddbca67c5b6301ac8b255.tar.xz
short circuit && and || when possible. This substantially reduces
the size of the -O0 output on some cases. For example, on expr.c from 176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed references to two external symbols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp28
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 1d9b30eca8..b042261ec3 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -217,34 +217,6 @@ void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
EmitDummyBlock();
}
-/// ContainsLabel - Return true if the statement contains a label in it. If
-/// this statement is not executed normally, it not containing a label means
-/// that we can just remove the code.
-static bool ContainsLabel(const Stmt *S, bool IgnoreCaseStmts = false) {
- // If this is a label, we have to emit the code, consider something like:
- // if (0) { ... foo: bar(); } goto foo;
- if (isa<LabelStmt>(S))
- return true;
-
- // If this is a case/default statement, and we haven't seen a switch, we have
- // to emit the code.
- if (isa<SwitchCase>(S) && !IgnoreCaseStmts)
- return true;
-
- // If this is a switch statement, we want to ignore cases below it.
- if (isa<SwitchStmt>(S))
- IgnoreCaseStmts = true;
-
- // Scan subexpressions for verboten labels.
- for (Stmt::const_child_iterator I = S->child_begin(), E = S->child_end();
- I != E; ++I)
- if (ContainsLabel(*I, IgnoreCaseStmts))
- return true;
-
- return false;
-}
-
-
void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
// C99 6.8.4.1: The first substatement is executed if the expression compares
// unequal to 0. The condition must be a scalar type.