================ @@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s + +// This test code generation when sycl_external attribute is used + +// Function defined and not used - symbols emitted +[[clang::sycl_external]] int square(int x) { return x*x; } +// CHECK: define dso_local spir_func noundef i32 @_Z6squarei + +// Function defined and used - symbols emitted +[[clang::sycl_external]] int squareUsed(int x) { return x*x; } +// CHECK: define dso_local spir_func noundef i32 @_Z10squareUsedi + +// Constexpr function defined and not used - symbols emitted +[[clang::sycl_external]] constexpr int squareInlined(int x) { return x*x; } +// CHECK: define linkonce_odr spir_func noundef i32 @_Z13squareInlinedi + +// Function declared but not defined or used - no symbols emitted +[[clang::sycl_external]] int declOnly(); +// CHECK-NOT: define {{.*}} i32 @_Z8declOnlyv ---------------- tahonermann wrote:
Let's also validate no declaration is emitted. ```suggestion // CHECK-NOT: define {{.*}} i32 @_Z8declOnlyv // CHECK-NOT: declare {{.*}}i32 @_Z8declOnlyv ``` https://github.com/llvm/llvm-project/pull/140282 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits