This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]