OpenCL should support array with const value size length, those const varibale in global and constant address space and variable in constant address space.
Details
- Reviewers
yaxunl Anastasia bader - Commits
- rG244e3f69e400: [OPENCL] Fix wrongly vla error for OpenCL array.
rGbdfbaaaefea3: [OPENCL] Fix wrongly vla error for OpenCL array.
rC271978: [OPENCL] Fix wrongly vla error for OpenCL array.
rC271971: [OPENCL] Fix wrongly vla error for OpenCL array.
rL271978: [OPENCL] Fix wrongly vla error for OpenCL array.
rL271971: [OPENCL] Fix wrongly vla error for OpenCL array.
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Sema/SemaType.cpp | ||
---|---|---|
2055 ↗ | (On Diff #56670) | Formatting looks weird though... may be better to leave the first line unmodified? |
test/CodeGenOpenCL/vla.cl | ||
1 ↗ | (On Diff #56670) | Could we have a Sema test instead where we accept the VLA if constant AS object is used and give an error otherwise? Also do we need to test CL2.0? We don't seem to be doing anything different for that version. |
lib/Sema/SemaType.cpp | ||
---|---|---|
2055 ↗ | (On Diff #56670) | I felt very strange, too. But this is what clang-format gives me. |
test/CodeGenOpenCL/vla.cl | ||
1 ↗ | (On Diff #56670) | In earier than OpenCL1.2 program scope variable must reside in constant address space and no const global int can be here. |
lib/Sema/SemaType.cpp | ||
---|---|---|
2055 ↗ | (On Diff #56670) | I see. clang-format doesn't take readability into account unfortunately. :) Let's just leave the first line of this change unmodified at least to make it more readable. |
test/CodeGenOpenCL/vla.cl | ||
1 ↗ | (On Diff #56670) | Why not? Could you write a complete example perhaps? I am not sure I understand your point. Thanks! |
lib/Sema/SemaType.cpp | ||
---|---|---|
2055 ↗ | (On Diff #56670) | OK, I also found the clang-format can do some strange thing. |
test/CodeGenOpenCL/vla.cl | ||
1 ↗ | (On Diff #56670) | Oh, I mean that in OpenCL 1.2 there will be some error message with const global int But I want to have a test with something that not only with the constant address space. |
test/CodeGenOpenCL/vla.cl | ||
---|---|---|
1 ↗ | (On Diff #56670) | Yes, I think this should be enough for testing your change. |
cfe/trunk/lib/Sema/SemaType.cpp | ||
---|---|---|
2067 | This looks wrong to me. The OpenCL rules don't permit arbitrary constant folding in array bounds. If OpenCL intends to permit reading from const globals of integral types in constant expressions (as C++ does but C does not), then the right way to handle that would be to change CheckICE to permit such cases, as it does in C++ mode, not to enable arbitrary constant folding in array bounds. |
This looks wrong to me. The OpenCL rules don't permit arbitrary constant folding in array bounds.
If OpenCL intends to permit reading from const globals of integral types in constant expressions (as C++ does but C does not), then the right way to handle that would be to change CheckICE to permit such cases, as it does in C++ mode, not to enable arbitrary constant folding in array bounds.