llvm-project/clang/test/SemaOpenCL
Richard Smith 6781fee085 Don't permit array bound constant folding in OpenCL.
Permitting non-standards-driven "do the best you can" constant-folding
of array bounds is permitted solely as a GNU compatibility feature. We
should not be doing it in any language mode that is attempting to be
conforming.

From https://reviews.llvm.org/D20090 it appears the intent here was to
permit `__constant int` globals to be used in array bounds, but the
change in that patch only added half of the functionality necessary to
support that in the constant evaluator. This patch adds the other half
of the functionality and turns off constant folding for array bounds in
OpenCL.

I couldn't find any spec justification for accepting the kinds of cases
that D20090 accepts, so a reference to where in the OpenCL specification
this is permitted would be useful.

Note that this change also affects the code generation in one test:
because after 'const int n = 0' we now treat 'n' as a constant
expression with value 0, it's now a null pointer, so '(local int *)n'
forms a null pointer rather than a zero pointer.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D89520
2020-10-20 16:52:28 -07:00
..
access-qualifier.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
address-spaces-conversions-cl2.0.cl [Sema][C++] Propagate conversion kind to specialize the diagnostics 2020-02-25 16:05:37 +00:00
address-spaces.cl Don't permit array bound constant folding in OpenCL. 2020-10-20 16:52:28 -07:00
amdgpu-attrs.cl [AMDGPU] Allow using integral non-type template parameters 2019-02-26 18:49:36 +00:00
arithmetic-conversions.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
arm-integer-dot-product.cl [OpenCL] Add support for the cl_arm_integer_dot_product extensions 2019-05-24 14:53:52 +00:00
array-init.cl [NFC] Fix line endings in OpenCL tests 2019-05-17 09:25:38 +00:00
array-parameters.cl
as_type.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
atomic-init.cl
atomic-ops.cl [OpenCL] Fix inconsistency between opencl and c11 atomic fetch max/min 2019-12-27 11:29:04 -05:00
block-array-capturing.cl [NFC] Fix typo in triples from unkown to unknown 2020-07-02 16:21:54 +08:00
bool-vectors.cl
builtin.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
builtins-amdgcn-error-ci.cl AMDGPU: Add DS GWS sema builtins 2019-06-20 21:33:57 +00:00
builtins-amdgcn-error-f16.cl AMDGPU: Add llvm.amdgcn.sqrt intrinsic 2020-06-26 15:07:07 -04:00
builtins-amdgcn-error-flat-address-space.cl AMDGPU: Add builtins for is_shared/is_private 2019-09-05 03:00:43 +00:00
builtins-amdgcn-error-gfx9.cl
builtins-amdgcn-error-gfx10-param.cl AMDGPU: Add some missing builtins 2019-07-17 00:01:03 +00:00
builtins-amdgcn-error-gfx10.cl AMDGPU: Add some missing builtins 2019-07-17 00:01:03 +00:00
builtins-amdgcn-error-gfx908-param.cl Add missing clang tests for 6d614a82a4 (AMDGPU MFMA built-ins) 2020-01-28 04:41:21 -05:00
builtins-amdgcn-error-vi.cl [AMDGPU] rename vi-insts into gfx8-insts 2019-04-05 18:25:00 +00:00
builtins-amdgcn-error.cl [AMDGPU] Change Clang AMDGCN atomic inc/dec builtins to take unsigned values 2020-07-07 06:36:25 +00:00
cl20-device-side-enqueue.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
clang-builtin-version.cl
clk_event_t.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
cond.cl
convergent.cl
endian-attr.cl
event_t.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
event_t_overload.cl [Sema][OpenCL] Make address space conversions a bit stricter. 2019-05-08 14:23:49 +00:00
ext_vectors.cl
extension-begin.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
extension-begin.h
extension-version.cl [OpenCL] Add cl_khr_extended_subgroup extensions. 2020-06-04 13:29:30 +01:00
extensions.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
fdeclare-opencl-builtins.cl [OpenCL] Add sub-group builtin functions 2020-04-02 13:18:56 +01:00
format-strings-fixit.cl [OpenGL] Fix test on PPC after r352540 2019-01-30 11:24:04 +00:00
fp-options.cl Reland D81869 "Modify FPFeatures to use delta not absolute settings" 2020-06-27 01:34:57 -07:00
func.cl
half.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
images.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
init.cl
intel-subgroup-avc-ext-types.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
invalid-assignment-constant-address-space.cl
invalid-block.cl [OpenCL] Reject block arguments 2020-06-29 14:13:12 +01:00
invalid-constant.cl
invalid-image.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
invalid-kernel-attrs.cl Add lifetime categories attributes 2019-07-25 17:50:51 +00:00
invalid-kernel-parameters.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
invalid-kernel.cl
invalid-pipe-builtin-cl2.0.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
invalid-pipes-cl2.0.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
lit.local.cfg
logical-ops.cl
multistep-explicit-cast.cl
nosvm.cl
null_literal.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
null_queue.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
numbered-address-space.cl [OpenCL] Fixed printing of __private in AMDGPU test 2019-12-27 17:08:42 +00:00
pipes-1.2-negative.cl
predefined-expr.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
printf-format-string-warnings.cl OpenCL: Use length modifier for warning on vector printf arguments 2019-01-29 20:49:54 +00:00
printf-format-strings.cl [AST] Use PrintingPolicy for format string diagnosis 2020-04-28 23:43:48 +01:00
queue_t_overload.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
recovery-expr.cl [AST][RecoveryExpr] Fix a crash on opencl C++. 2020-07-20 15:15:30 +02:00
sampler_t.cl [OpenCL] Move addr space deduction to Sema. 2019-11-27 12:44:42 +00:00
sampler_t_overload.cl
shifts.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
sizeof.cl
storageclass-cl20.cl
storageclass.cl
str_literals.cl
to_addr_builtin.cl [NFC] Sema: use checkArgCount instead of custom checking 2020-07-28 13:41:06 -07:00
types.cl
unroll-hint.cl
unsupported.cl
usm-address-spaces-conversions.cl [OpenCL] Add global_device and global_host address spaces 2020-07-29 17:24:53 +03:00
vec_compare.cl
vec_step.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
vector_conv_invalid.cl [OpenCL] Pretty print __private addr space 2019-12-27 13:42:07 +00:00
vector_inc_dec_ops.cl
vector_literals_invalid.cl
vector_swizzle_length.cl
warn-missing-prototypes.cl Suggestions to fix -Wmissing-{prototypes,variable-declarations} 2019-06-18 22:57:08 +00:00