[llvm] [SPIRV] Promote scalar arguments to vector for `OpExtInst` in `generateExtInst` instead of `SPIRVRegularizer` (PR #170155)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 05:16:40 PST 2025


================
@@ -0,0 +1,21 @@
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown < %s | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown < %s -filetype=obj | not spirv-val 2>&1 | FileCheck %s --check-prefix=VALIDATOR %}
+;
+; _Z3miniii is not a valid OpenCL intrinsic, do not treat it like one.
+;
+; VALIDATOR: Invalid instruction OpExtInst starting at word {{[0-9]+}}: expected no more operands after 7 words, but stated word count is 8
+
+define spir_kernel void @ill_1() {
+; CHECK-LABEL:   OpFunction %{{[0-9]+}} None %{{[0-9]+}} ; -- Begin function ill_1
+; CHECK-NEXT:    OpLabel
+; This is wrong, we should generate a regular call
----------------
jmmartinez wrote:

Yes. This problem is orthogonal to the one addressed in the PR.

The backend's builtin recognition matches builtins using the demangled function name, the first argument and eventually the last argument. But not the exact mangled function name.

`min(int, int, int)` has the same demangled name and first argument type as `min(int int)`, so both match the `s_min` OpenCL builtin.

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


More information about the llvm-commits mailing list