diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-11-12 08:13:36 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-11-12 08:13:36 +0000 |
| commit | 552f4c45ba4f4a01f86d585edabd871a27829867 (patch) | |
| tree | 58678677cc4e4e632a215480578e20f518930454 /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 035cf4294319271ad19ddcc5ba327c8365f3575e (diff) | |
| download | clang-552f4c45ba4f4a01f86d585edabd871a27829867.tar.gz clang-552f4c45ba4f4a01f86d585edabd871a27829867.tar.bz2 clang-552f4c45ba4f4a01f86d585edabd871a27829867.tar.xz | |
Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
codegen stuff like "if (!(X && Y))"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index a797d75963..0756de7a8a 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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. |
