> You are proposing to complete the ssa representation such that
> foreach_ssa_uses also iterates over the niter information (a bit like vrp
> modifies the ssa chains with its extra assert information). Wouldn't it
> be possible to not insert this niter information in the representation of
> the
> program (ie. not inserting a new tree node) but just modify the ssa
> iterators
> to also return the expressions that we store on the side?
yes, it would be possible, however, possibly quite error-prone.
> What are the other transformations that remove definitions that are not
> used?
ivopts remove bivs that they replace, and I suspect that vectorizer
does something similar as well. I do not know about other optimizers.