Skip to content

Commit f3f3883

Browse files
committed
[RISCV] Fix crash reported in #109313
Change edc71e2 had tried to handle the case where an instruction wasn't available, but had used a dyn_cast instead of a dyn_cast_or_null. Switch instead to an explicit null check, and a cast.
1 parent e45f9aa commit f3f3883

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,13 +1051,12 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
10511051
// vp load/store
10521052
case Intrinsic::vp_load:
10531053
case Intrinsic::vp_store: {
1054+
if (!ICA.getInst())
1055+
break;
10541056
Intrinsic::ID IID = ICA.getID();
10551057
std::optional<unsigned> FOp = VPIntrinsic::getFunctionalOpcodeForVP(IID);
1056-
auto *UI = dyn_cast<VPIntrinsic>(ICA.getInst());
1057-
1058-
if (!UI)
1059-
break;
10601058
assert(FOp.has_value());
1059+
auto *UI = cast<VPIntrinsic>(ICA.getInst());
10611060
if (ICA.getID() == Intrinsic::vp_load)
10621061
return getMemoryOpCost(
10631062
*FOp, ICA.getReturnType(), UI->getPointerAlignment(),

0 commit comments

Comments
 (0)