llvm-project/clang/test/CodeGenOpenCL
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
..
2011-04-15-vec-init-from-vec.cl
addr-space-struct-arg.cl Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
address-space-constant-initializers.cl
address-spaces-conversions.cl [OpenCL] Add global_device and global_host address spaces 2020-07-29 17:24:53 +03:00
address-spaces-mangling.cl [OpenCL] Fixed addr space manging test. 2019-01-31 15:23:48 +00:00
address-spaces.cl [OpenCL] Add global_device and global_host address spaces 2020-07-29 17:24:53 +03:00
amdgcn-automatic-variable.cl [opaque pointer types] Cleanup CGBuilder's Create*GEP. 2019-02-08 15:34:12 +00:00
amdgcn-flat-scratch-name.cl
amdgcn-large-globals.cl Recommit #2 "[Driver] Default to -fno-common for all targets" 2020-03-09 19:57:03 +00:00
amdgpu-abi-struct-coerce.cl Reapply "OpaquePtr: Add type to sret attribute" 2020-10-16 11:05:02 -04:00
amdgpu-alignment.cl [opaque pointer types] Cleanup CGBuilder's Create*GEP. 2019-02-08 15:34:12 +00:00
amdgpu-attrs.cl [clang][opencl][codegen] Remove the insertion of `correctly-rounded-divide-sqrt-fp-math` fn-attr. 2020-10-01 11:07:39 -04:00
amdgpu-call-kernel.cl
amdgpu-calling-conv.cl
amdgpu-debug-info-pointer-address-space.cl AMDGPU: Teach toolchain to link rocm device libs 2020-04-10 13:37:32 -04:00
amdgpu-debug-info-variable-expression.cl AMDGPU: Teach toolchain to link rocm device libs 2020-04-10 13:37:32 -04:00
amdgpu-enqueue-kernel.cl IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
amdgpu-env-amdgcn.cl [AMDGPU] Add the missing clang change of the experimental buffer fat pointer 2019-03-18 18:11:37 +00:00
amdgpu-features.cl [AMDGPU] gfx1032 target 2020-10-15 12:41:18 -07:00
amdgpu-nullptr.cl Don't permit array bound constant folding in OpenCL. 2020-10-20 16:52:28 -07:00
amdgpu-sizeof-alignof.cl
arm-integer-dot-product.cl [OpenCL] Add support for the cl_arm_integer_dot_product extensions 2019-05-24 14:53:52 +00:00
as_type.cl
atomic-ops-libcall.cl
atomic-ops.cl AMDGPU: Add support for cross address space synchronization scopes (clang) 2019-03-25 20:54:00 +00:00
backend-unsupported-warning.ll Fix test without built AMDGPU 2020-04-27 13:32:00 -04:00
blocks.cl [OpenCL] Reject block arguments 2020-06-29 14:13:12 +01:00
bool_cast.cl
builtins-amdgcn-ci.cl AMDGPU: Add builtins for is_shared/is_private 2019-09-05 03:00:43 +00:00
builtins-amdgcn-dl-insts-err-clamp.cl AMDGPU: Fix target builtins for gfx10 2019-06-22 01:30:00 +00:00
builtins-amdgcn-dl-insts-err.cl AMDGPU: Fix target builtins for gfx10 2019-06-22 01:30:00 +00:00
builtins-amdgcn-dl-insts.cl AMDGPU: Fix target builtins for gfx10 2019-06-22 01:30:00 +00:00
builtins-amdgcn-gfx9.cl AMDGPU: Fix target builtins for gfx10 2019-06-22 01:30:00 +00:00
builtins-amdgcn-gfx10.cl AMDGPU: Update clang test 2020-01-16 18:10:29 -05:00
builtins-amdgcn-interp.cl [AMDGPU] Add interpolation builtins 2019-01-28 13:50:37 +00:00
builtins-amdgcn-mfma.cl Add missing clang tests for 6d614a82a4 (AMDGPU MFMA built-ins) 2020-01-28 04:41:21 -05:00
builtins-amdgcn-vi.cl [AMDGPU] Make ds fp atomics overloadable 2020-09-23 11:39:50 -07:00
builtins-amdgcn.cl AMDGPU: Add llvm.amdgcn.sqrt intrinsic 2020-06-26 15:07:07 -04:00
builtins-f16.cl Builtins: Start adding half versions of math builtins 2019-08-06 03:28:37 +00:00
builtins-generic-amdgcn.cl Updated the signature for some stack related intrinsics (CLANG) 2019-07-22 12:50:30 +00:00
builtins-r600.cl
builtins.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
byval.cl
cast_image.cl
cl-strict-aliasing.cl
cl-uniform-wg-size.cl
cl20-device-side-enqueue.cl [CodeGen] Simplify the way lifetime of block captures is extended 2020-06-11 16:06:22 -07:00
const-str-array-decay.cl
constant-addr-space-globals.cl [opaque pointer types] Cleanup CGBuilder's Create*GEP. 2019-02-08 15:34:12 +00:00
convergent.cl [SimplifyCFG] Do not create unneeded PR Phi in block with convergent calls 2020-07-22 13:53:50 +07:00
enqueue-kernel-non-entry-block.cl [Driver] Pass -gno-column-info instead of -dwarf-column-info 2020-07-05 11:50:38 -07:00
event_t.cl
ext-int-shift.cl Reland Implement _ExtInt as an extended int type specifier. 2020-04-17 10:45:48 -07:00
ext-vector-shuffle.cl
extension-begin.cl
fdeclare-opencl-builtins.cl [OpenCL] Fix mangling of single-overload builtins 2019-12-03 11:09:16 +00:00
fpmath.cl [clang][opencl][codegen] Remove the insertion of `correctly-rounded-divide-sqrt-fp-math` fn-attr. 2020-10-01 11:07:39 -04:00
func-call-dbg-loc.cl [Driver] Pass -gno-column-info instead of -dwarf-column-info 2020-07-05 11:50:38 -07:00
half.cl Add Microsoft Mangling for OpenCL Half Type 2018-05-01 14:16:15 +00:00
images.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
inline-asm-amdgcn.cl [AMDGPU] Added support of new inline assembler constraints 2020-07-03 18:01:12 +03:00
intel-subgroups-avc-ext-types.cl [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension 2018-11-08 11:25:41 +00:00
kernel-arg-info-single-as.cl
kernel-arg-info.cl
kernel-attributes.cl
kernel-metadata.cl
kernels-have-spir-cc-by-default.cl LLVM IR: Generate new-style byval-with-Type from Clang 2019-06-05 21:12:14 +00:00
lifetime.cl
local-initializer-undef.cl
local.cl
logical-ops.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
memcpy.cl
no-half.cl
no-signed-zeros.cl [NFC] Fix line endings in OpenCL tests 2019-05-17 09:25:38 +00:00
norecurse.cl [OpenCL][CUDA][HIP][SYCL] Add norecurse 2020-02-16 20:41:00 -05:00
null_queue.cl
numbered-address-space.cl [Sema][OpenCL] Make address space conversions a bit stricter. 2019-05-08 14:23:49 +00:00
opencl_types.cl [OpenCL] Add separate read_only and write_only pipe IR types 2018-04-27 10:37:04 +00:00
overload.cl
partial_initializer.cl CGDecl::emitStoresForConstant fix synthesized constant's name 2018-11-15 00:19:18 +00:00
pipe_builtin.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
pipe_types.cl [OpenCL] Add separate read_only and write_only pipe IR types 2018-04-27 10:37:04 +00:00
pipe_types_mangling.cl Implement post-commit comments for D75685/rG86e0a6c60627 2020-03-25 12:24:56 -07:00
preserve_vec3.cl
printf.cl Revert "OpenCL: Extend argument promotion rules to vector types" 2019-01-29 20:49:47 +00:00
private-array-initialization.cl CGDecl::emitStoresForConstant fix synthesized constant's name 2018-11-15 00:19:18 +00:00
ptx-calls.cl
ptx-kernels.cl
relaxed-fpmath.cl Reland D81869 "Modify FPFeatures to use delta not absolute settings" 2020-06-27 01:34:57 -07:00
sampler.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
shifts.cl [OpenCL] make test independent of optimizer 2018-05-16 14:38:07 +00:00
single-precision-constant.cl [clang] FastMathFlags.allowContract should be initialized only from FPFeatures.allowFPContractAcrossStatement 2020-05-20 06:19:10 -07:00
size_t.cl
spir-calling-conv.cl
spir32_target.cl
spir64_target.cl
spir_version.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
str_literals.cl [OpenCL] Add constant address space to __func__ in AST. 2018-05-09 13:23:26 +00:00
to_addr_builtin.cl [OpenCL] Rename lang mode flag for C++ mode 2019-07-25 11:04:29 +00:00
unroll-hint.cl [OpenCL] Generate 'unroll.enable' metadata for __attribute__((opencl_unroll_hint)) 2019-03-20 16:43:07 +00:00
vectorLoadStore.cl
vector_literals_valid.cl [OpenCL] Fix vector literal test broken in rL367675. 2019-08-05 09:50:28 +00:00
vector_logops.cl
vector_odd.cl
vector_shufflevector_valid.cl
visibility.cl Move setTargetAttributes after setGVProperties in SetFunctionAttributes 2019-04-23 21:50:11 +00:00
vla.cl