[llvm] [NVPTX] add an optional early copy of byval arguments (PR #113384)

Akshay Deodhar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 15:05:31 PDT 2024


================
@@ -734,3 +739,21 @@ bool NVPTXLowerArgs::runOnFunction(Function &F) {
 }
 
 FunctionPass *llvm::createNVPTXLowerArgsPass() { return new NVPTXLowerArgs(); }
+
+static bool copyFunctionByValArgs(Function &F) {
+  LLVM_DEBUG(dbgs() << "Creating a copy of byval args of " << F.getName()
+                    << "\n");
+  bool Changed = false;
+  for (Argument &Arg : F.args())
+    if (Arg.getType()->isPointerTy() && Arg.hasByValAttr()) {
+      copyByValParam(F, Arg);
----------------
akshayrdeodhar wrote:

Sounds good. 

https://github.com/llvm/llvm-project/pull/113384


More information about the llvm-commits mailing list