Index: llvm/lib/MC/MCExpr.cpp =================================================================== --- llvm/lib/MC/MCExpr.cpp +++ llvm/lib/MC/MCExpr.cpp @@ -886,7 +886,7 @@ Addrs, InSet)) { // Check if both are Target Expressions, see if we can compare them. if (const MCTargetExpr *L = dyn_cast(ABE->getLHS())) - if (const MCTargetExpr *R = cast(ABE->getRHS())) { + if (const MCTargetExpr *R = dyn_cast(ABE->getRHS())) { switch (ABE->getOpcode()) { case MCBinaryExpr::EQ: Res = MCValue::get((L->isEqualTo(R)) ? -1 : 0); Index: llvm/lib/Object/ELFObjectFile.cpp =================================================================== --- llvm/lib/Object/ELFObjectFile.cpp +++ llvm/lib/Object/ELFObjectFile.cpp @@ -800,8 +800,6 @@ return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); if (const auto *Obj = dyn_cast(this)) return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); - if (const auto *Obj = cast(this)) - return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); - else - llvm_unreachable("Unsupported binary format"); + const auto *Obj = cast(this); + return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); } Index: llvm/utils/TableGen/DecoderEmitter.cpp =================================================================== --- llvm/utils/TableGen/DecoderEmitter.cpp +++ llvm/utils/TableGen/DecoderEmitter.cpp @@ -2108,7 +2108,7 @@ if (Decoder == "" && CGI.Operands[SO.first].MIOperandInfo && CGI.Operands[SO.first].MIOperandInfo->getNumArgs()) { Init *Arg = CGI.Operands[SO.first].MIOperandInfo->getArg(SO.second); - if (DefInit *DI = cast(Arg)) + if (DefInit *DI = dyn_cast(Arg)) TypeRecord = DI->getDef(); }