diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp --- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -426,8 +426,9 @@ VReg, MRI, isFConstant, getCImmOrFPImmAsAPInt, LookThroughInstrs); if (!Reg) return std::nullopt; - return FPValueAndVReg{getConstantFPVRegVal(Reg->VReg, MRI)->getValueAPF(), - Reg->VReg}; + const ConstantFP *CFP = getConstantFPVRegVal(Reg->VReg, MRI); + assert(CFP && "invalid ConstantFP!"); + return FPValueAndVReg{CFP->getValueAPF(), Reg->VReg}; } const ConstantFP *