Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently

codegen stuff like "if (!(X && Y))"

llvm-svn: 59115
This commit is contained in:
Chris Lattner 2008-11-12 08:13:36 +00:00
parent 51e7118c30
commit d95377341b
1 changed files with 6 additions and 1 deletions

View File

@ -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.