Skip to content

Commit 3d7d246

Browse files
committed
[RICSV] PerformDAGCombine - don't directly dereference dyn_cast results
Use cast<> to assert the cast is valid to help avoid null dereferences Fixes static analyser warnings
1 parent 286955c commit 3d7d246

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16894,7 +16894,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1689416894
DAG.getNode(ISD::FNEG, DL, VT, NewFPExtRound));
1689516895
}
1689616896
case ISD::MGATHER: {
16897-
const auto *MGN = dyn_cast<MaskedGatherSDNode>(N);
16897+
const auto *MGN = cast<MaskedGatherSDNode>(N);
1689816898
const EVT VT = N->getValueType(0);
1689916899
SDValue Index = MGN->getIndex();
1690016900
SDValue ScaleOp = MGN->getScale();
@@ -16994,7 +16994,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1699416994
break;
1699516995
}
1699616996
case ISD::MSCATTER:{
16997-
const auto *MSN = dyn_cast<MaskedScatterSDNode>(N);
16997+
const auto *MSN = cast<MaskedScatterSDNode>(N);
1699816998
SDValue Index = MSN->getIndex();
1699916999
SDValue ScaleOp = MSN->getScale();
1700017000
ISD::MemIndexType IndexType = MSN->getIndexType();
@@ -17030,7 +17030,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1703017030
break;
1703117031
}
1703217032
case ISD::VP_GATHER: {
17033-
const auto *VPGN = dyn_cast<VPGatherSDNode>(N);
17033+
const auto *VPGN = cast<VPGatherSDNode>(N);
1703417034
SDValue Index = VPGN->getIndex();
1703517035
SDValue ScaleOp = VPGN->getScale();
1703617036
ISD::MemIndexType IndexType = VPGN->getIndexType();
@@ -17055,7 +17055,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1705517055
break;
1705617056
}
1705717057
case ISD::VP_SCATTER: {
17058-
const auto *VPSN = dyn_cast<VPScatterSDNode>(N);
17058+
const auto *VPSN = cast<VPScatterSDNode>(N);
1705917059
SDValue Index = VPSN->getIndex();
1706017060
SDValue ScaleOp = VPSN->getScale();
1706117061
ISD::MemIndexType IndexType = VPSN->getIndexType();

0 commit comments

Comments
 (0)