yxsamliu wrote:

I have some doubt whether this will work for CUDA/HIP since their AST is not 
aware of address space. When translated to IR, any pointer is expected to 
pointing to default addr space. That is why alloca is immediately casted to 
generic pointer and used as generic pointer to match other parts of AST. For 
example:

```
__device__ void f(int*);
__device__ void g() {
  int a[10];
  int *p = a;
  f(a);
}
```
both p and f is expecting generic pointer in IR. Actually anywhere a is used, 
it is expected to be a generic pointer. That's why we need to cast it to 
generic pointer and use it as a generic pointer in the beginning.

https://github.com/llvm/llvm-project/pull/129837
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to