Issue 143191
Summary [HLSL] static constants are not fully optimized
Labels HLSL, backend:SPIR-V
Assignees
Reporter s-perron
    The example below will generate a call to an intrinsic `@llvm.invariant.start.p0` it indicate that the variable will not change after it is initialized. However, this seems to hinder optimizations. The store to the variable is still present after optimizations. See https://godbolt.org/z/fT39qoafr.

```
RWBuffer<int> b : register(u0);

int foo() { return 20; }

static const int c = foo();

[numthreads(1,1,1)]
void main() {
    b[0] = c;
}
```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to