This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Add conditional compare support
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: joseph at codesourcery dot com
- Cc: gcc-patches at gcc dot gnu dot org, zhenqiang dot chen at linaro dot org
- Date: Fri, 23 Aug 2013 17:27:12 EDT
- Subject: Re: [RFC] Add conditional compare support
- References: <CACgzC7CAQtOZ6QtjCZsS+KOtqCGLVvtAV1nSFTdVFfP1T==jdQ at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1308232112490 dot 12585 at digraph dot polyomino dot org dot uk>
> That doesn't sound like the right place to me. We want the same code to
> be generated whether users write && and || directly or write corresponding
> sequences of if conditions. In general we want to move away from
> optimizing complicated expressions in fold-const, towards having GIMPLE
> passes that detect the relevant patterns however they were written (and
> without needing to combine GIMPLE back into trees for passing through the
> old folder).
I'm not convinced that it's an "either or". Certainly the optimization
needs to be in one of the GIMPLE passes for exactly the reason you give.
Theoretically, fold-const need do nothing, but I think that's only in
"theory". Giving later-pass optimizers better code when possible at least
speeds up the process and at best produces better generated code.
Obviously, one can't do everything everywhere, but I wouldn't reject doing
something earlier just because it's also done later.