------- Additional Comments From law at redhat dot com 2005-08-10 18:57 ------- Subject: Re: [tree-ssa] Merge two "if"s if one subsumes the other.
On Sat, 2005-06-11 at 19:16 +0000, pinskia at gcc dot gnu dot org wrote: > ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-11 > 19:16 ------- > (In reply to comment #3) > > And it should merge them, too, like for > > I better testcase which shows why we don't convert i > j || i == j into i >= j > which is reduced from Richard's tramp3d: > int g(void); > int h(void); > int f(int *i, int *j) > { > while (1) > { > if (*i > *j || *i == *j) > break; > return g(); > } > return h(); > } At first I thought we might be able to do this via VRP. But after more thought, I don't see this kind of transformation fitting into the VRP framework. It wouldn't be terribly hard to write a new optimizer to perform this transformation, and I would expect it would be pretty efficient. It would need to run after copy propagation and DCE since useless copies would easily get in the way of successful optimization. I'm pretty sure it could be done with a single pass through the IL. Jeff -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15353