[cfe-commits] r72842 - in /cfe/trunk/lib/CodeGen: CGExprAgg.cpp CGExprScalar.cpp
Anders Carlsson
andersca at mac.com
Wed Jun 3 20:00:33 PDT 2009
Author: andersca
Date: Wed Jun 3 22:00:32 2009
New Revision: 72842
URL: http://llvm.org/viewvc/llvm-project?rev=72842&view=rev
Log:
Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary operator.
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72842&r1=72841&r2=72842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Jun 3 22:00:32 2009
@@ -263,17 +263,21 @@
llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond());
Builder.CreateCondBr(Cond, LHSBlock, RHSBlock);
+ CGF.PushConditionalTempDestruction();
CGF.EmitBlock(LHSBlock);
// Handle the GNU extension for missing LHS.
assert(E->getLHS() && "Must have LHS for aggregate value");
Visit(E->getLHS());
+ CGF.PopConditionalTempDestruction();
CGF.EmitBranch(ContBlock);
+ CGF.PushConditionalTempDestruction();
CGF.EmitBlock(RHSBlock);
Visit(E->getRHS());
+ CGF.PopConditionalTempDestruction();
CGF.EmitBranch(ContBlock);
CGF.EmitBlock(ContBlock);
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=72842&r1=72841&r2=72842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jun 3 22:00:32 2009
@@ -1452,7 +1452,8 @@
CGF.getContext().BoolTy);
Builder.CreateCondBr(CondBoolVal, LHSBlock, RHSBlock);
}
-
+
+ CGF.PushConditionalTempDestruction();
CGF.EmitBlock(LHSBlock);
// Handle the GNU extension for missing LHS.
@@ -1462,12 +1463,15 @@
else // Perform promotions, to handle cases like "short ?: int"
LHS = EmitScalarConversion(CondVal, E->getCond()->getType(), E->getType());
+ CGF.PopConditionalTempDestruction();
LHSBlock = Builder.GetInsertBlock();
CGF.EmitBranch(ContBlock);
+ CGF.PushConditionalTempDestruction();
CGF.EmitBlock(RHSBlock);
Value *RHS = Visit(E->getRHS());
+ CGF.PopConditionalTempDestruction();
RHSBlock = Builder.GetInsertBlock();
CGF.EmitBranch(ContBlock);
More information about the cfe-commits
mailing list