[llvm] [Verifier] Use size_t width for reqd_work_group_size check (PR #206214)

Wenju He via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 27 21:35:10 PDT 2026


================
@@ -0,0 +1,76 @@
+; RUN: split-file %s %t
+; RUN: llvm-as %t/valid64.ll --disable-output 2>&1 | count 0
+; RUN: not llvm-as %t/overflow64.ll --disable-output 2>&1 | FileCheck %s --check-prefix=OVERFLOW
+; RUN: llvm-as %t/valid32.ll --disable-output 2>&1 | count 0
+; RUN: not llvm-as %t/overflow32.ll --disable-output 2>&1 | FileCheck %s --check-prefix=OVERFLOW
+; RUN: not llvm-as %t/operand-too-large32.ll --disable-output 2>&1 | FileCheck %s --check-prefix=OPERAND
+; RUN: not llvm-as %t/operand-too-large64.ll --disable-output 2>&1 | FileCheck %s --check-prefix=OPERAND
+
+; OVERFLOW: reqd_work_group_size product must fit in size_t
+; OPERAND: reqd_work_group_size operands must fit in size_t
+
+;--- valid64.ll
+; UINT64_MAX * 1 * 1: product fits in 64-bit size_t.
+target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1"
+target triple = "spirv64-unknown-unknown"
----------------
wenju-he wrote:

> The triple is not necessary here, I think. The data layout is sufficient. Also, I also don't think we need the full layout. Just add the size part for size_t.

done, thanks

> I also wonder, what would `size_t` mean for a SPIR-V target?

good question.
For SPIR-V, size_t maps to the addressing model:
- Physical32: Indicates a 32-bit module, where the address width is equal to 32 bits.
- Physical64: Indicates a 64-bit module, where the address width is equal to 64 bits.

size_t matches size of pointer of a target.


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


More information about the llvm-commits mailing list