[llvm] [SPIRV] Fix code quality issues. (PR #152005)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 04:16:50 PDT 2025
================
@@ -474,6 +474,7 @@ Register SPIRVGlobalRegistry::getOrCreateBaseRegister(
}
if (Type->getOpcode() == SPIRV::OpTypeFloat) {
SPIRVType *SpvBaseType = getOrCreateSPIRVFloatType(BitWidth, I, TII);
+ assert(isa<ConstantFP>(Val) && "Expected ConstantFP for OpTypeFloat");
return getOrCreateConstFP(dyn_cast<ConstantFP>(Val)->getValue(), I,
----------------
Keenuts wrote:
If we expect Val to be a ConstantFP, don't assert before, but replace the `dyn_cast` by a `cast`. Cast will fail if it's not the correct type.
https://github.com/llvm/llvm-project/pull/152005
More information about the llvm-commits
mailing list