Fix assertion/crash when optimizing function with dead basic block (#54690)
AllocOpt probably needs to handle that in other places more smartly but
this seems to at least stop it crashing. Fixes issue found in
https://github.com/JuliaLang/julia/pull/54604#issuecomment-2136320508 by
@topolarity.