[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
This commit is contained in:
Simon Pilgrim 2022-04-07 12:13:55 +01:00
parent d356cdcf31
commit 46f0e2ceb4
1 changed files with 2 additions and 2 deletions

View File

@ -270,7 +270,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function *> &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<Function>(Root);
auto *F = dyn_cast<Function>(Root);
if (F) {
if (Functions.count(F))
// We're keeping this function.
@ -278,7 +278,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function *> &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;
}