[llvm] [SPIR-V] Emit UniformId decoration as OpDecorateId with a Scope id operand (PR #207958)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 02:55:45 PDT 2026
================
@@ -318,9 +318,27 @@ void buildOpSpirvDecorations(Register Reg, MachineIRBuilder &MIRBuilder,
static_cast<uint32_t>(SPIRV::Decoration::FPFastMathMode)) {
continue; // Ignored.
}
- auto MIB = MIRBuilder.buildInstr(SPIRV::OpDecorate)
- .addUse(Reg)
- .addImm(static_cast<uint32_t>(DecorationId->getZExtValue()));
+ uint32_t Dec = static_cast<uint32_t>(DecorationId->getZExtValue());
+ if (Dec == static_cast<uint32_t>(SPIRV::Decoration::UniformId)) {
+ ConstantInt *ScopeV =
+ OpMD->getNumOperands() > 1
+ ? mdconst::dyn_extract<ConstantInt>(OpMD->getOperand(1))
+ : nullptr;
+ if (!ScopeV || !isUInt<32>(ScopeV->getZExtValue()))
+ report_fatal_error("Expect Scope <id> operand of the UniformId "
+ "decoration");
----------------
aobolensk wrote:
Switched to assert. Thanks for the feedback
https://github.com/llvm/llvm-project/pull/207958
More information about the llvm-commits
mailing list