From 46f0e2ceb4875f69ec76af6bc2e02aa359cccb64 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 7 Apr 2022 12:13:55 +0100 Subject: [PATCH] [bugpoint] ReduceCrashingFunctions::TestFuncs - fix dereference of null point static analyzer warning Alias.getAliaseeObject() shouldn't be null, do use dyn_cast instead of dyn_cast_or_null Also, remove redundant `else if (!F)` test - that is always true at the point in the if-else chain --- llvm/tools/bugpoint/CrashDebugger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index d127ea0945f2..9912f59f0ba6 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -270,7 +270,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { // First, remove aliases to functions we're about to purge. for (GlobalAlias &Alias : M->aliases()) { GlobalObject *Root = Alias.getAliaseeObject(); - Function *F = dyn_cast_or_null(Root); + auto *F = dyn_cast(Root); if (F) { if (Functions.count(F)) // We're keeping this function. @@ -278,7 +278,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { } else if (Root->isNullValue()) { // This referenced a globalalias that we've already replaced, // so we still need to replace this alias. - } else if (!F) { + } else { // Not a function, therefore not something we mess with. continue; }