[PATCH] D34367: CodeGen: Fix address space of indirect function argument

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 12:12:18 PST 2018


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:3446
+  return LV.asAggregateRValue();
+}
+
----------------
No, I don't think this is right.  This method should always return an independent RValue; if the CallArg is storing an LValue, it should copy from it into a temporary.  That means it needs to take a CGF, and it also means you can't call it eagerly.


================
Comment at: lib/CodeGen/CGCall.cpp:3779
+      RV = I->getRValue();
+    }
 
----------------
For example, all of this is eagerly forcing an RValue, and it needs to be delayed so that you can take advantage of having an LValue in the right cases below.


================
Comment at: lib/CodeGen/CGCall.cpp:3814
         EmitInitStoreOfNonAggregate(*this, RV, argLV);
       }
       break;
----------------
I think most of this could be replaced with a copyInto(CGF&, Address) method on CallArg that just stores/copies the RValue into the destination.  But you might need to handle the aggregate-RValue case specially before calling the method, because I think what that's expressing is that we're trying to evaluate aggregate-RValue arguments directly into the right place in the inalloca allocation.


https://reviews.llvm.org/D34367





More information about the cfe-commits mailing list