[mlir] Add a null pointer check in symbol lookup (#115165)
Dead code analysis crashed because a symbol that is called/used didn't appear in the symbol table. This patch fixes this by adding a nullptr check after symbol table lookup.
This commit is contained in:
parent
5a5122cac6
commit
13317502da
@ -186,6 +186,8 @@ void DeadCodeAnalysis::initializeSymbolCallables(Operation *top) {
|
||||
// If a callable symbol has a non-call use, then we can't be guaranteed to
|
||||
// know all callsites.
|
||||
Operation *symbol = symbolTable.lookupSymbolIn(top, use.getSymbolRef());
|
||||
if (!symbol)
|
||||
continue;
|
||||
auto *state = getOrCreate<PredecessorState>(getProgramPointAfter(symbol));
|
||||
propagateIfChanged(state, state->setHasUnknownPredecessors());
|
||||
}
|
||||
|
@ -265,3 +265,7 @@ func.func @test_dca_doesnt_crash() -> () {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func.func @test_dca_doesnt_crash_2() -> () attributes {symbol = @notexistant} {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user