[llvm] [SPIR-V] Don't lower builtin variadic functions (PR #188517)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 27 03:12:13 PDT 2026
================
@@ -984,6 +993,29 @@ struct SPIRV final : public VariadicABIInfo {
return {A, false};
}
+ // The SPIR-V backend has special handling for builtins.
+ bool ignoreFunction(Function *F) override {
+ if (!F->isDeclaration())
+ return false;
+
+ StringRef Name = F->getName();
+
+ // Skip any SPIR-V builtins.
+ if (Name.contains("__spirv_"))
+ return true;
+
+ // Skip the builtin printf function.
+ if (Name.contains("printf")) {
+ std::string Demangled = llvm::demangle(Name.str());
+ // Demangled name will be "printf(...)" for the builtin, "printf" for
+ // unmangled extern "C", or "namespace::printf(...)" for namespaced.
+ if (StringRef(Demangled).starts_with("printf(") || Demangled == "printf")
+ return true;
+ }
----------------
MrSidims wrote:
I must say, I'm not a biggest fun of doing check with contains, but guess making SPIR-V backend flow smarter regarding builtins detection goes outside of the scope of this patch.
https://github.com/llvm/llvm-project/pull/188517
More information about the llvm-commits
mailing list