summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-12 08:13:36 +0000
committerChris Lattner <sabre@nondot.org>2008-11-12 08:13:36 +0000
commitd95377341b7bf916ec102cebf302a90dc1ce37b8 (patch)
tree180f1dc9f310f1d47fdcfe3746fa432771796daf /clang/lib/CodeGen/CodeGenFunction.cpp
parent51e7118c3056f7b7d8dd1fc16bfbeb854f5172c9 (diff)
downloadbcm5719-llvm-d95377341b7bf916ec102cebf302a90dc1ce37b8.tar.gz
bcm5719-llvm-d95377341b7bf916ec102cebf302a90dc1ce37b8.zip
Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
codegen stuff like "if (!(X && Y))" llvm-svn: 59115
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index a797d75963f..0756de7a8a7 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -263,7 +263,12 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
EmitBranchOnBoolExpr(CondBOp->getRHS(), TrueBlock, FalseBlock);
return;
}
-
+ }
+
+ if (const UnaryOperator *CondUOp = dyn_cast<UnaryOperator>(Cond)) {
+ // br(!x, t, f) -> br(x, f, t)
+ if (CondUOp->getOpcode() == UnaryOperator::LNot)
+ return EmitBranchOnBoolExpr(CondUOp->getSubExpr(), FalseBlock, TrueBlock);
}
// Emit the code with the fully general case.
OpenPOWER on IntegriCloud