google / google/clspv

Invalid OpPtrAccessChain into a Function Storage pointer

Open
#1,360 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
729
Forks
110
Avg merge
17h 51m
Merged PRs (30d)
23

Description

The following:
```cpp
struct InstanceTest
{
uint data1_;
uint data2_;
uint data3_;
};

__kernel void test(__global InstanceTest* dst)
{
const size_t index = get_global_id(0);
InstanceTest instances[2];

if (index < 2) {
dst[index] = instances[index];
}
}
```
Generates a OpPtrAccessChain into a function storage pointer:
```llvm
%35 = OpPtrAccessChain %_ptr_Function_uint %33 %uint_3
```
https://gcc.godbolt.org/z/oz5MGoWd5

I don't think this is valid.
See also https://github.com/google/clspv/issues/135

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.