This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -funswitch-loops not effective?
On Tue, 18 Jan 2005 12:16:56 -0800, Richard Henderson <rth@redhat.com> wrote:
> On Tue, Jan 18, 2005 at 08:54:14PM +0100, Richard Guenther wrote:
> > If so, why don't we model this
> > invariant and exploit it in the optimizers?
>
> Because with function inlining, it is exceedingly hard to do this.
>
> What you wind up with is "this field cannot be modified except
> within this region". Which, unless you come up with some way to
> model this that's better than what we've thought up before, will
> degenerate into the equivalent of RTX_UNCHANGING_P. Which I think
> everyone will agree was a nightmare.
Indeed. But not doing this optimization is hurting some C++ code a lot
-- we may do better than RTX_UNCHANGING_P by tying the optimization
to the frontend somehow, after all, it's all about language semantics. Also
we have something like this already, otherwise optimizing a const global
would not work (like the testcase somewhere way up this thread).
Richard.