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<MCTargetExpr>(ABE->getLHS())) { - const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS()); + const MCTargetExpr *R = dyn_cast<MCTargetExpr>(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 @@ -783,8 +783,6 @@ return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); if (const auto *Obj = dyn_cast<ELF32BEObjectFile>(this)) return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); - if (const auto *Obj = cast<ELF64BEObjectFile>(this)) - return readBBAddrMapImpl(Obj->getELFFile(), TextSectionIndex); - else - llvm_unreachable("Unsupported binary format"); + return readBBAddrMapImpl(cast<ELF64BEObjectFile>(this)->getELFFile(), + TextSectionIndex); }