From 93ee5ca805f9d51c13dc613a07048ea83728fd97 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sat, 16 Jun 2012 02:19:17 +0000 Subject: Fix Sema and IRGen for atomic compound assignment so it has the right semantics when promotions are involved. (As far as I can tell, this only affects some edge cases.) llvm-svn: 158591 --- clang/lib/CodeGen/CGExprScalar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CGExprScalar.cpp') diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index e0265545be3..1c1075cdcae 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1683,11 +1683,9 @@ LValue ScalarExprEmitter::EmitCompoundAssignLValue( // Load/convert the LHS. LValue LHSLV = EmitCheckedLValue(E->getLHS()); OpInfo.LHS = EmitLoadOfLValue(LHSLV); - OpInfo.LHS = EmitScalarConversion(OpInfo.LHS, LHSTy, - E->getComputationLHSType()); llvm::PHINode *atomicPHI = 0; - if (const AtomicType *atomicTy = OpInfo.Ty->getAs()) { + if (LHSTy->isAtomicType()) { // FIXME: For floating point types, we should be saving and restoring the // floating point environment in the loop. llvm::BasicBlock *startBB = Builder.GetInsertBlock(); @@ -1696,10 +1694,12 @@ LValue ScalarExprEmitter::EmitCompoundAssignLValue( Builder.SetInsertPoint(opBB); atomicPHI = Builder.CreatePHI(OpInfo.LHS->getType(), 2); atomicPHI->addIncoming(OpInfo.LHS, startBB); - OpInfo.Ty = atomicTy->getValueType(); OpInfo.LHS = atomicPHI; } - + + OpInfo.LHS = EmitScalarConversion(OpInfo.LHS, LHSTy, + E->getComputationLHSType()); + // Expand the binary operator. Result = (this->*Func)(OpInfo); -- cgit v1.2.3