This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Constant propagation and strength reduction
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: Neil Booth <neil at daikokuya dot co dot uk>, <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 21 Jan 2003 10:54:17 -0700 (MST)
- Subject: Re: Constant propagation and strength reduction
> Some of my colleagues at IBM noticed a surprising case where GCC
> does not propagate a constant to allow optimization of a divide.
> ...
> So why doesn't GCC propagate the constant when compiling with
> optimization? Is this a C language requirement? The constant
> needs to be propagated in the tree representation so that
> expand_divmod chooses the optimized algorithm.
The problem is that currently GCC doesn't perform any form of
constant propagation at the tree-level. The only transformations
performed by fold work on a single statement at a time.
The good news is that this should be fixed by the new SSA passes
once they come online.
I'll also look into fixing this at the simplify-rtx level. If
enough of the expand_divmod code is generic enough, we should be
re-use it, should CSE/GCSE or similar propagate a constant into
the division.
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833