Artem-B wrote:

It has nothing to do with writing to those arrays while the kernel is running. 
That would indeed be UB.

> both would still work just the same even with this change,

No, they will not. Here's the demonstration of the behavior change that `const` 
brings to the table:
https://cuda.godbolt.org/z/h6e5Wb4PT

It shows that adding `const` allows compiler to use the initializer values as 
written (it does not even bother instantiating `cxxx`), while without `const` 
it reads the array values, assuming that they may be changed externally.


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

Reply via email to