aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-05-23 04:13:59 +0000
committerMike Stump <mrs@apple.com>2009-05-23 04:13:59 +0000
commitfde6420cb9142f7f4efe5ec69a216295d83bcda4 (patch)
tree9d0bcbee1edd79748c9346300c1a5e1310c190c6 /lib/CodeGen/CGExprAgg.cpp
parent2665a75c16b93a4977225472aa0e7bcf32ddcec6 (diff)
One step to fixing up codegen for a=b, where a is a volatile struct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 81e1a12de7..13559acc0d 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -247,7 +247,7 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
RValue::getAggregate(AggLoc));
} else {
// Codegen the RHS so that it stores directly into the LHS.
- CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), false /*FIXME: VOLATILE LHS*/);
+ CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), LHS.isVolatileQualified());
if (DestPtr == 0)
return;
@@ -519,6 +519,18 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr,
// FIXME: Handle variable sized types.
const llvm::Type *IntPtr = llvm::IntegerType::get(LLVMPointerWidth);
+ // FIXME: If we have a volatile struct, the optimizer can remove what might
+ // appear to be `extra' memory ops:
+ //
+ // volatile struct { int i; } a, b;
+ //
+ // int main() {
+ // a = b;
+ // a = b;
+ // }
+ //
+ // either, we need to use a differnt call here, or the backend needs to be
+ // taught to not do this.
Builder.CreateCall4(CGM.getMemCpyFn(),
DestPtr, SrcPtr,
// TypeInfo.first describes size in bits.