Skip to content

Commit 53d9c7b

Browse files
authored
[sycl-post-link] Add more cases to filter out from entry point check (#6874)
This change addresses #5878 Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent 9baa9d9 commit 53d9c7b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

llvm/tools/sycl-post-link/ModuleSplitter.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,23 @@ bool isSpirvSyclBuiltin(StringRef FName) {
108108
return FName.startswith("__spirv_") || FName.startswith("__sycl_");
109109
}
110110

111+
// Return true if the function is a ESIMD builtin
112+
// The regexp for ESIMD intrinsics:
113+
// /^_Z(\d+)__esimd_\w+/
114+
bool isESIMDBuiltin(StringRef FName) {
115+
if (!FName.consume_front("_Z"))
116+
return false;
117+
// now skip the digits
118+
FName = FName.drop_while([](char C) { return std::isdigit(C); });
119+
120+
return FName.startswith("__esimd_");
121+
}
122+
123+
// Return true if the function name starts with "__builtin_"
124+
bool isGenericBuiltin(StringRef FName) {
125+
return FName.startswith("__builtin_");
126+
}
127+
111128
bool isKernel(const Function &F) {
112129
return F.getCallingConv() == CallingConv::SPIR_KERNEL;
113130
}
@@ -128,7 +145,8 @@ bool isEntryPoint(const Function &F, bool EmitOnlyKernelsAsEntryPoints) {
128145
// are also considered as entry points (except __spirv_* and __sycl_*
129146
// functions)
130147
return F.hasFnAttribute(ATTR_SYCL_MODULE_ID) &&
131-
!isSpirvSyclBuiltin(F.getName());
148+
!isSpirvSyclBuiltin(F.getName()) && !isESIMDBuiltin(F.getName()) &&
149+
!isGenericBuiltin(F.getName());
132150
}
133151

134152
return false;

0 commit comments

Comments
 (0)