[PATCH] D98469: [NVPTX] Avoid temp copy of byval kernel parameters.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 11 17:05:03 PST 2021


asbirlea added inline comments.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXLowerArgs.cpp:165-166
+  if (auto *LI = dyn_cast<LoadInst>(I)) {
+    auto *NewLI = new LoadInst(LI->getType(), Param, LI->getName(),
+                               LI->isVolatile(), LI->getAlign(), I);
+    LI->replaceAllUsesWith(NewLI);
----------------
jlebar wrote:
> Looking at https://llvm.org/docs/LangRef.html#load-instruction, there's a lot of additional metadata that might be on a load instruction.  Do we need to copy it?  (Is there no LLVM utility that says, "create a new load in a different address space?)
> 
> Also, should we disallow atomic loads or otherwise handle them?
AFAIK there is no such utility.

```
AAMDNodes AATags;
LI->getAAMetadata(AATags);
NewLI->setAAMetadata(AATags);
```
Perhaps also set debug location, e.g. `NewLI->setDebugLoc(DebugLoc());` 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98469/new/

https://reviews.llvm.org/D98469



More information about the llvm-commits mailing list