[cfe-commits] r59115 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Chris Lattner
sabre at nondot.org
Wed Nov 12 00:13:36 PST 2008
Author: lattner
Date: Wed Nov 12 02:13:36 2008
New Revision: 59115
URL: http://llvm.org/viewvc/llvm-project?rev=59115&view=rev
Log:
Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently
codegen stuff like "if (!(X && Y))"
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=59115&r1=59114&r2=59115&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Nov 12 02:13:36 2008
@@ -263,7 +263,12 @@
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.
More information about the cfe-commits
mailing list