aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-03-23 03:00:06 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-03-23 03:00:06 +0000
commitf52bbeb1ce55aa10b4519024258b8962777fa8d4 (patch)
treee082df0d7db1a83704d0b49c8e8ea8781ac9a6c7 /lib/CodeGen/CGExprScalar.cpp
parent38a08d2749e4efd4c6465b7987f11343aaa35dd9 (diff)
Fix a subtle bug in CodeGen for the increment of a bitfield.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 80aa755e18..89f28bea6d 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -620,9 +620,8 @@ Value *ScalarExprEmitter::VisitBlockDeclRefExpr(const BlockDeclRefExpr *E) {
Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
bool isInc, bool isPre) {
LValue LV = EmitLValue(E->getSubExpr());
- // FIXME: Handle volatile!
- Value *InVal = CGF.EmitLoadOfLValue(LV, // false
- E->getSubExpr()->getType()).getScalarVal();
+ QualType ValTy = E->getSubExpr()->getType();
+ Value *InVal = CGF.EmitLoadOfLValue(LV, ValTy).getScalarVal();
int AmountVal = isInc ? 1 : -1;
@@ -667,8 +666,11 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
}
// Store the updated result through the lvalue.
- CGF.EmitStoreThroughLValue(RValue::get(NextVal), LV,
- E->getSubExpr()->getType());
+ if (LV.isBitfield())
+ CGF.EmitStoreThroughBitfieldLValue(RValue::get(NextVal), LV, ValTy,
+ &NextVal);
+ else
+ CGF.EmitStoreThroughLValue(RValue::get(NextVal), LV, ValTy);
// If this is a postinc, return the value read from memory, otherwise use the
// updated value.