Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3117,7 +3117,8 @@ continue; } case OPC_RecordMemRef: - MatchedMemRefs.push_back(cast(N)->getMemOperand()); + if (auto *MN = dyn_cast(N)) + MatchedMemRefs.push_back(MN->getMemOperand()); continue; case OPC_CaptureGlueInput: