Skip to content

Commit

Permalink
[sycl-post-link] Add more cases to filter out from entry point check (#…
Browse files Browse the repository at this point in the history
…6874)

This change addresses #5878

Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>
  • Loading branch information
asudarsa committed Sep 29, 2022
1 parent 9baa9d9 commit 53d9c7b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion llvm/tools/sycl-post-link/ModuleSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ bool isSpirvSyclBuiltin(StringRef FName) {
return FName.startswith("__spirv_") || FName.startswith("__sycl_");
}

// Return true if the function is a ESIMD builtin
// The regexp for ESIMD intrinsics:
// /^_Z(\d+)__esimd_\w+/
bool isESIMDBuiltin(StringRef FName) {
if (!FName.consume_front("_Z"))
return false;
// now skip the digits
FName = FName.drop_while([](char C) { return std::isdigit(C); });

return FName.startswith("__esimd_");
}

// Return true if the function name starts with "__builtin_"
bool isGenericBuiltin(StringRef FName) {
return FName.startswith("__builtin_");
}

bool isKernel(const Function &F) {
return F.getCallingConv() == CallingConv::SPIR_KERNEL;
}
Expand All @@ -128,7 +145,8 @@ bool isEntryPoint(const Function &F, bool EmitOnlyKernelsAsEntryPoints) {
// are also considered as entry points (except __spirv_* and __sycl_*
// functions)
return F.hasFnAttribute(ATTR_SYCL_MODULE_ID) &&
!isSpirvSyclBuiltin(F.getName());
!isSpirvSyclBuiltin(F.getName()) && !isESIMDBuiltin(F.getName()) &&
!isGenericBuiltin(F.getName());
}

return false;
Expand Down

0 comments on commit 53d9c7b

Please sign in to comment.