[llvm] [Offload] Tests for global memory and constructors (PR #147537)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 07:29:26 PDT 2025


================
@@ -0,0 +1,16 @@
+#include <gpuintrin.h>
+#include <stdint.h>
+
+[[clang::loader_uninitialized]]
+uint32_t global[64];
+
+__attribute__((constructor)) void ctor() {
+  for (unsigned I = 0; I < 64; I++)
+    global[I] = 100;
+}
----------------
jhuber6 wrote:

Loop here doesn't really do much, also we should check the priority and have a destructor test. Checking the result of a destructor is obviously hard without prints, but still nice to see if it generated properly.

https://github.com/llvm/llvm-project/pull/147537


More information about the llvm-commits mailing list