From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?= Date: Mon, 2 Feb 2026 13:49:36 +0100 Subject: [01/13] [Backport to 22] [NFC] Allow `llvm::Value` derived types on `SPIRVMDWalker::get` (#3557) Origin: upstream, https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/2b26eccd60779a30c588571c84e67a036402b19e This is used later by https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/3475 --- lib/SPIRV/SPIRVMDWalker.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/SPIRV/SPIRVMDWalker.h b/lib/SPIRV/SPIRVMDWalker.h index 1b7febe1..c08a02d8 100644 --- a/lib/SPIRV/SPIRVMDWalker.h +++ b/lib/SPIRV/SPIRVMDWalker.h @@ -91,7 +91,9 @@ public: bool atEnd() const { return !(M && I < E); } - template MDWrapper &get(T &V) { + template >> + MDWrapper &get(IntegerType &V) { if (!Q) assert(I < E && "out of bound"); if (atEnd()) @@ -115,12 +117,14 @@ public: return *this; } - MDWrapper &get(Function *&F) { + template >> + MDWrapper &get(ValueType *&V) { if (!Q) assert(I < E && "out of bound"); if (atEnd()) return *this; - F = mdconst::dyn_extract(M->getOperand(I++)); + V = mdconst::dyn_extract(M->getOperand(I++)); return *this; } -- 2.55.0