"Rohit Arul Raj" <[EMAIL PROTECTED]> writes:
> This small bit of code worked fine with all optimization except Os.
>
> unsigned int n = 30;
> void x ()
> {
> unsigned int h;
> h = n <= 30; // Line 1
> if (h)
> p = 1;
> else
> p = 0;
> }
>
> when we tried to debug the emitted RTL instruction for Os, it was
> found that RTL instruction for Line #1 (Compare and gtu) were not at
> all emitted. i.e. there is no reference with respect to "h or n". For
> the same optimization Os, if we declare the identifier "h" as global,
> it generates the instructions properly.
That small bit of code won't compile, since 'p' is undeclared. If 'p'
is a global variable, then this certainly seems to be a bug. But you
should be aware that -Os changes inlining behaviour, and different
inlining may cause different behaviour here depending on how 'p' is
used.
> While checking the Dumps of RTL, the above mentioned code for "h, n"
> was present in the file 20020611-1.c.25.cse2 but not in
> 20020611-1.c.26.life1.
>
> 1. Is the file 20020611-1.c.25.cse2 input to life1 optimization pass?
It is a dump of what the intermediate representation looks like after
the cse2 pass.
> 2. What does .life1 Life analysis pass do ?
It does flow analysis: it records which pseudo-registers are live at
all parts of the program. It also does a number of minor random
cleanups.
> 3. What are the probable causes for the elimination of RTL code's
> (Compare & gtu) between the above mentioned passes?
The probable cause is that 'p' appears to be unused, and the
assignment to 'p' is dead.
Ian