================
@@ -23,11 +24,11 @@ using namespace mlir::abi;
 //
 // For byval (ArgClassification::byVal == true) the callee gets
 // llvm.byval + llvm.noalias + llvm.noundef; for byref (byVal == false)
-// the callee gets llvm.byref without the ownership attrs.  Both pass
-// through an alloca+store at the call site.  At the callee, byval loads
-// the incoming pointer (a local copy), while byref rewires the CIRGen
-// param-slot alloca to the incoming pointer so the body mutates the
-// caller's storage in place.
+// the callee gets llvm.byref without the ownership attrs.  At the call site
+// byval copies into a fresh alloca while byref forwards the caller's storage.
----------------
andykaylor wrote:

This comment seems wrong, but I think I've managed to figure it out. We've got 
multiple levels of representation using the same basic terminology but meaning 
different things. What you're calling "byref" here is an argument that was 
passed by value in the source code by gets classified as "Indirect" and not 
"byval" in the ABI classifier. If I've understood correctly, an argument that 
is passed by reference in the C++ source code sense is classified as "Direct" 
by the ABI classifier because it's already a pointer in the initial CIR 
representation.

Can you add a comment clarifying this?

https://github.com/llvm/llvm-project/pull/216499
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to