[clang] [CIR][CUDA][HIP] Skip alias emission when the aliasee is not emitted (PR #234627)

Arseniy Obolenskiy via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 26 05:46:50 PDT 2026


================
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \
+// RUN:   -fclangir -emit-cir %s -o - \
+// RUN:   | FileCheck %s --check-prefix=CIR --implicit-check-not=One --implicit-check-not=Missing
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \
+// RUN:   -fclangir -emit-llvm %s -o - \
+// RUN:   | FileCheck %s --check-prefix=LLVM --implicit-check-not=One --implicit-check-not=Missing
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fopenmp -fopenmp-is-target-device \
+// RUN:   -emit-llvm %s -o - \
+// RUN:   | FileCheck %s --check-prefix=OGCG --implicit-check-not=One --implicit-check-not=Missing
+
+// Aliasee without declare target: skipped on the device.
+int __One(void) { return 1; }
+int One(void) __attribute__((weak, alias("__One")));
+int One_(void) __attribute__((alias("__One")));
+
+// Declare target aliasee: emitted on the device.
+// CIR-DAG: cir.func weak hidden @Two() -> !s32i alias(@__Two)
+// CIR-DAG: cir.func hidden dso_local @Two_() -> !s32i alias(@__Two)
----------------
aobolensk wrote:

Yes, alias lowering drops visibility. Gonna fix it separately. The PR will be mentioned here

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


More information about the cfe-commits mailing list