From ae95f291e8d92bb7396219839efc0012a13378e1 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 25 Mar 2022 10:23:22 +0000 Subject: [PATCH] [AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid dereference of nullptr The pointer is used immediately inside the getSymbol() call, so assert the cast is correct instead of returning nullptr --- llvm/lib/CodeGen/AsmPrinter/AIXException.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp index 5d06670..f179c0a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp @@ -73,8 +73,8 @@ void AIXException::endFunction(const MachineFunction *MF) { const Function &F = MF->getFunction(); assert(F.hasPersonalityFn() && "Landingpads are presented, but no personality routine is found."); - const GlobalValue *Per = - dyn_cast(F.getPersonalityFn()->stripPointerCasts()); + const auto *Per = + cast(F.getPersonalityFn()->stripPointerCasts()); const MCSymbol *PerSym = Asm->TM.getSymbol(Per); emitExceptionInfoTable(LSDALabel, PerSym); -- 2.7.4