This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] REG_EQUAL notes on cond_jumps.
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 14 May 2003 15:28:47 -0600 (MDT)
- Subject: Re: [PATCH] REG_EQUAL notes on cond_jumps.
> Hi Roger,
>
> > For example, pa.md doesn't support comparison with large immediate
> > constants in a single instruction. As a result code such as the
> > following (reduced from 20010119-1.c) was failing to be optimized:
> >
> > void foo()
> > {
> > int a = 10;
> > int b = 20000;
> > if (a > b)
> > link_error();
> > }
>
> This is an over simplification of the problem.
I apologise. The above test case is indeed an over simplification.
I was just trying to explain that simple comparisons cannot be
optimized by GCSE, they can however be optimized by other passes.
A more accurate example is:
void foo()
{
int a = 10;
int b = 20000;
int c;
for(c=0; c<1000; c++)
if (a < b)
link_error();
}
By forcing the constants definitions and uses into different basic
blocks, CSE is no longer able to perform the simplification, but
alas GCSE can't *yet* do it either.
I apologise if my over simplification of the issues was confusing.
One of the main points I was trying to show was that this failure
is unrelated to __builtin_constant_p, but instead a generic failing
of GCC's GCSE pass.
Roger
--