aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index bdd7975fa0..9daa21eb34 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -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;
}