[clang] [CIR] Support CXXAddrspaceCastExpr in CIRGenFunction::emitLValue (PR #237423)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 17:27:29 PST 2026


================
@@ -1,7 +1,18 @@
-//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s
+// RUN: %if cir-enabled %{ %clang_cc1 %s -triple spir -fclangir -emit-llvm -O0 -o - | FileCheck %s %}
 
-//CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1i
+// CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1i
 void bar(global int *gl) {
-  //CHECK: addrspacecast ptr addrspace(1) %{{[0-9]+}} to ptr addrspace(4)
+  // CHECK: addrspacecast ptr addrspace(1) %{{[0-9]+}} to ptr addrspace(4)
   int *gen = addrspace_cast<int *>(gl);
 }
+
+struct S {
+  int x;
+};
+
+// CHECK-LABEL: define{{.*}} spir_func void @_Z4bar2PU3AS11S
+void bar2(global S *s) {
+  // CHECK: addrspacecast ptr addrspace(1) %{{.*}} to ptr addrspace(4)
----------------
andykaylor wrote:

It doesn't look like this reaches the changed code.

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


More information about the cfe-commits mailing list