This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2005 18:57:52 -0000
- Subject: [Bug tree-optimization/15353] [tree-ssa] Merge two "if"s if one subsumes the other.
- References: <20040509200719.15353.kazu@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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