[cfe-commits] r51558 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Eli Friedman
eli.friedman at gmail.com
Sun May 25 07:13:57 PDT 2008
Author: efriedma
Date: Sun May 25 09:13:57 2008
New Revision: 51558
URL: http://llvm.org/viewvc/llvm-project?rev=51558&view=rev
Log:
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?
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=51558&r1=51557&r2=51558&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Sun May 25 09:13:57 2008
@@ -768,6 +768,11 @@
// 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 @@
// 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;
}
More information about the cfe-commits
mailing list