https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107972
--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> --- Its because we don't go back and re-propagate into previous basic block. Take an integral vexample: unsigned foo (unsigned a, unsigned b) { unsigned res = a + b; if (res > 100) return 42 if (a > 30 || b > 30) __builtin_unreachable (); if (res > 100) return 42 return res; The branch which restricts the range of a and b to [0,30] causes GORI to recompute "res = a + b" on each edge, so those values are pushed along any outgoing edges, and when we see res > 100 the second time we fold that away. Thats all handled buy GORI which is basic-block oriented only. At no point (yet anyway) do we attempt to push these values back further in the CFG, so therefore we don't touch the conditions that were encountered earlier, and cannot eliminate the earlier compare and return. I have contemplated a new kind of VRP analysis pass which leverages what we did with 'assume', propagates known values backwards and looks for opportunities earlier in the CFG that are exposed by information determined later in the IL. This sort of thing would probably require such a pass.