[AsmPrinter] AIXException::endFunction - use cast<> instead of dyn_cast<> to avoid...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 25 Mar 2022 10:23:22 +0000 (10:23 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 25 Mar 2022 10:23:30 +0000 (10:23 +0000)
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

index 5d06670..f179c0a 100644 (file)
@@ -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<GlobalValue>(F.getPersonalityFn()->stripPointerCasts());
+  const auto *Per =
+      cast<GlobalValue>(F.getPersonalityFn()->stripPointerCasts());
   const MCSymbol *PerSym = Asm->TM.getSymbol(Per);
 
   emitExceptionInfoTable(LSDALabel, PerSym);