Fix for PR2001. I'm not really fond of it, but it is correct (unless

someone tries to make a bitfield volatile?).

Not sure how to write a test; any suggestions?

llvm-svn: 51558
This commit is contained in:
Eli Friedman 2008-05-25 14:13:57 +00:00
parent 0e56c82e4a
commit 292e98cc18
1 changed files with 10 additions and 1 deletions

View File

@ -768,6 +768,11 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
// Store the result value into the LHS lvalue.
CGF.EmitStoreThroughLValue(RValue::get(Result), LHSLV, E->getType());
// For bitfields, we need the value in the bitfield
// FIXME: This adds an extra bitfield load
if (LHSLV.isBitfield())
Result = EmitLoadOfLValue(LHSLV, LHSTy);
return Result;
}
@ -963,7 +968,11 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
// Store the value into the LHS.
// FIXME: Volatility!
CGF.EmitStoreThroughLValue(RValue::get(RHS), LHS, E->getType());
// For bitfields, we need the value in the bitfield
// FIXME: This adds an extra bitfield load
if (LHS.isBitfield())
return EmitLoadOfLValue(LHS, E->getLHS()->getType());
// Return the RHS.
return RHS;
}