When rewriting loop exit values, IndVars considers this transform not profitable if
the loop instruction has a loop user which it believes cannot be optimized away.
In current implementation only calls that immediately use the instruction are considered
as such.
This patch extends the definition of "hard" users to any side-effecting instructions
(which usually cannot be optimized away from the loop) and also allows handling
of not just immediate users, but use chains.
we may also stop and return true if Curr is a phi node, since phi nodes cannot be eliminated easily.
But we need to be careful that:
In this case we still what to rewrite %inc outside of the loop to a constant. (or it is handle by the other part of this pass?)