[clang] [llvm] [clang][OpenMP][SPIR-V] Fix addrspace of global constants (PR #134399)

Shangwu Yao via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 20 16:22:53 PDT 2025


ShangwuYao wrote:

This test reproduces the issue above:

```
// RUN: %clang_cc1 -fcuda-is-device -triple spirv32 -o - -emit-llvm -x cuda %s  | FileCheck %s
// RUN: %clang_cc1 -fcuda-is-device -triple spirv64 -o - -emit-llvm -x cuda %s  | FileCheck %s

// CHECK: @.str = private unnamed_addr addrspace(4) constant [13 x i8] c"Hello World\0A\00", align 1 

extern "C" __attribute__((device)) int printf(const char* format, ...);

__attribute__((global)) void printf_kernel() {
  printf("Hello World\n");
}
```

Could you also add the test case as test/CodeGenCUDASPIRV/printf.cu or something? Thanks!!


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


More information about the llvm-commits mailing list