Tr : [redundency elimination, code motion, commun expression elimination] GCC optimizations

Amker.Cheng amker.cheng@gmail.com
Tue Sep 27 16:47:00 GMT 2011


On Tue, Sep 27, 2011 at 1:12 PM, Miles Bader <miles@gnu.org> wrote:
> Miles Bader <miles@gnu.org> writes:
>>> Hmm, actually testing with a recent gcc snapshot, it _is_ merging the
>>> two if-blocks:
>> ...
>>
>> and in fact, gcc 4.4.6, 4.5.3, and 4.6.1 seem to do the same thing!
>>
>> So I dunno... what's the complaint again...?
>
> I note that this optimization only takes place at -O2 or above; maybe
> the original poster simply didn't use a high-enough optimization level?
>
> -miles
>
> --
> I'd rather be consing.
>

A case I ran into with gcc trunk after cprop1 pass:

  cc <- compare(r684, 0)
  if (cc != 0) goto .L1
  r191 <- 0
  goto .L2
.L1:
  r191 <- 0
  ...other insns
.L2:

In my experiment, both following pre and cse passes do not hoist the
r191<-0 to the beginning.
I understand that it is actually not a redundant case, and not pre's job.
So which pass in gcc might handle it? Thanks very much.

Wondering is it a similar story to the original post?
-- 
Best Regards.



More information about the Gcc-help mailing list