[llvm] [SPIR-V] Don't consider a function be a builtin just by checking name (PR #182776)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 05:26:25 PST 2026


================
@@ -3110,7 +3134,8 @@ mapBuiltinToOpcode(const StringRef DemangledCall,
   Register Reg;
   SmallVector<Register> Args;
   std::unique_ptr<const IncomingCall> Call =
-      lookupBuiltin(DemangledCall, Set, Reg, nullptr, Args);
+      lookupBuiltin(DemangledCall, Set, Reg, nullptr, Args,
+                    /*ValidateArgCount=*/false);
----------------
MrSidims wrote:

Apologies, I forgot to put a FIXME with a comment to remove `ValidateArgCount` argument at all as it should always be `true`. There is an odd bug for __spirv_ builtins that is being exposed only for atomic builtins tests causing an incorrect pointer argument type to be generated if there is no mangling applied. _Somehow_ this change exposes it (note, SPIRVBuiltins.td seem to be specifying a correct number of arguments for "__spirv_AtomicSMin" and other builtins).

Let me do some debugging. If the fix is trivial, I'll apply it right away, if not (and "a major refactoring from line noted on L3129 is required), then I'll leave a FIXME.

https://github.com/llvm/llvm-project/pull/182776


More information about the llvm-commits mailing list