[clang] [llvm] [Clang][OpenMP] Support expression semantics in target update fields with non-contiguous array sections (PR #176708)
Abhinav Gaba via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 8 08:04:17 PDT 2026
================
@@ -0,0 +1,142 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _ --global-value-regex "\.offload_.*" --global-hex-value-regex ".offload_maptypes.*" --version 3
+
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -o - \
+// RUN: | FileCheck %s
+
+// Check same results after serialization round-trip
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -include-pch %t -emit-llvm %s -o - \
+// RUN: | FileCheck %s
+
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+// Test that variable stride expressions in target update directives correctly
+// set the OMP_MAP_NON_CONTIG flag. For NON_CONTIG entries, offload_sizes contains
+// dimension count (2 for 1D array section). For non-NON_CONTIG entries,
+// offload_sizes contains byte size (5 elements * 4 bytes = 20).
+extern int get_stride();
+int data[10];
+int stride;
+
+void test_variable_stride_to() {
+ stride = get_stride();
----------------
abhinavgaba wrote:
No need for `get_stride()`. The global `stride` can be used directly.
https://github.com/llvm/llvm-project/pull/176708
More information about the cfe-commits
mailing list