[cfe-commits] r72347 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Mike Stump mrs at apple.com
Sat May 23 15:01:33 PDT 2009


Author: mrs
Date: Sat May 23 17:01:27 2009
New Revision: 72347

URL: http://llvm.org/viewvc/llvm-project?rev=72347&view=rev
Log:
Fix thinko, and implement aggregate volatile reads.

Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72347&r1=72346&r2=72347&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat May 23 17:01:27 2009
@@ -131,9 +131,14 @@
   assert(Src.isAggregate() && "value must be aggregate value!");
 
   // If the result is ignored, don't copy from the value.
-  if (DestPtr == 0)
-    // FIXME: If the source is volatile, we must read from it.
-    return;
+  if (DestPtr == 0) {
+    if (Src.isVolatileQualified())
+      // If the source is volatile, we must read from it; to do that, we need
+      // some place to put it.
+      DestPtr = CGF.CreateTempAlloca(CGF.ConvertType(E->getType()), "agg.tmp");
+    else
+      return;
+  }
 
   // If the result of the assignment is used, copy the LHS there also.
   // FIXME: Pass VolatileDest as well.  I think we also need to merge volatile
@@ -197,7 +202,7 @@
 }
 
 void AggExprEmitter::VisitBinComma(const BinaryOperator *E) {
-  CGF.EmitAnyExprToTemp(E->getLHS(), 0, VolatileDest);
+  CGF.EmitAnyExpr(E->getLHS());
   CGF.EmitAggExpr(E->getRHS(), DestPtr, VolatileDest);
 }
 





More information about the cfe-commits mailing list