Remove redundant cast<> and null check.

"Repl" member is guranteed to have a non-null pointer. If an input
section is not merged by ICF, "Repl" points to "this". Otherwise, it
points to some other section. It must not be NULL.

llvm-svn: 313556
This commit is contained in:
Rui Ueyama 2017-09-18 19:15:54 +00:00
parent 307e039d8c
commit 27a357c9d9
1 changed files with 4 additions and 6 deletions

View File

@ -446,12 +446,10 @@ bool EhFrameSection<ELFT>::isFdeLive(EhSectionPiece &Piece,
const RelTy &Rel = Rels[FirstRelI];
SymbolBody &B = Sec->template getFile<ELFT>()->getRelocTargetSym(Rel);
auto *D = dyn_cast<DefinedRegular>(&B);
if (!D || !D->Section)
if (auto *D = dyn_cast<DefinedRegular>(&B))
if (D->Section)
return cast<InputSectionBase>(D->Section)->Repl->Live;
return false;
auto *Target =
cast<InputSectionBase>(cast<InputSectionBase>(D->Section)->Repl);
return Target && Target->Live;
}
// .eh_frame is a sequence of CIE or FDE records. In general, there