[PATCH] D91928: [nvptx] Skip alloca for read-only byval arguments.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 22 09:40:07 PST 2020


jlebar added a comment.

> I don't believe there's any exception to prove deduction [of the readonly attribute] wrong.

Understood.

> The address space inference here only refers to the one in the backend directly after this argument lowering gpass.

Also understood.

This isn't speaking to my concern, though.

Suppose we have

  __global__ void foo(int x, const int* y, int* out, bool flag) {
    int* ptr = flag ? &x : y;
    *out = *ptr;
  }

In this case we can say with confidence that x is readonly.

But address space inference cannot infer the address space of ptr (how could it?).  Therefore we will do a generic load, which is wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91928



More information about the llvm-commits mailing list