================ @@ -0,0 +1,77 @@ +// 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 ---------------- tahonermann wrote:
Functions declared `constexpr` are implicitly `inline` and are therefore available with the same definition in every translation unit that declares them (under penalty of the ODR). We therefore shouldn't have to emit an unused one. 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