This is the mail archive of the 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: [PATCH] Improved SAVE_EXPR handling in operand_equal_p

Hi Kaveh,

On Mon, 8 Sep 2003, Kaveh R. Ghazi wrote:
>  > From: Roger Sayle <>
>  > Kaveh, is it possible to only enable the "cabs(z) != cabs(z)" tests
>  > at optimization levels -O2 and above?  Sorry for the inconvenience.
> I'll do that if you can please explain to me why this works with
> optimization and not without it.  (And why we can rely on that being
> the case.)

Certainly.  Because of the use of SAVE_EXPR to prevent re-evaluation
the tree-level constant folders and RTL expanders are unable to
determine that save_expr(x*x) is the same as save_expr(x*x).  Instead,
the duplication is discovered at the RTL level during CSE or the
local_cprop passes of GCSE.  The x*x is a common subexpression of
both so one expression can be replaced by the other.  This is enough
to simplify the comparison, when ends up comparing the same pseudo.

The issue is that CSE is only run when "(optimize > 0)" and similarly
for GCSE.  So if we don't run the passes that recognize equivalent
expressions within a basic block, we never notice that link_error_cabs
is dead.

As you correctly point out CSE is enabled at -O1 (which fixes the
testcase),  so checking for __OPTIMIZE__ is sufficient.  Sorry for
the confusion by mentioning -O2.

I hope this helps explain things.


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