https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104530
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- What could be done in passes like evrp or vrp* but not in unrelated other passes that use the range infrastructure would be to set uids on stmts depending on presence of calls that might not always return in the middle of basic blocks (and perhaps other stmts, wonder about e.g. inline asm), and optimize whenever the comparison and dereference have the same uid (aka there is nothing in between that would make the optimization problematic).