public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* regarding optimization options in phase ordering
@ 2009-08-07 11:53 pms
  2009-08-07 12:34 ` Richard Guenther
  0 siblings, 1 reply; 6+ messages in thread
From: pms @ 2009-08-07 11:53 UTC (permalink / raw)
  To: gcc


Hi,
     We've a problem here. we were trying to use cc1 with & without -O
option to verify the optimizations happening in our sample code. these r the
list of outputs after each compilation
without -O
pms@Shiva:~/Desktop/Compilers/GCC/build/test$ ls
1.c                1.c.011t.ehopt        1.c.038t.release_ssa
1.c.001t.tu        1.c.012t.eh           1.c.123t.optimized
1.c.003t.original  1.c.013t.cfg          1.c.125t.blocks
1.c.004t.gimple    1.c.014t.cplxlower0   1.c.126t.final_cleanup
1.c.006t.vcg       1.c.015t.veclower     1.c.203t.statistics
1.c.007t.useless   1.c.021t.cleanup_cfg  1.s
1.c.010t.lower     1.c.023t.ssa          a.out

with -O

1.c                           1.c.051t.ccp2         1.c.085t.sink
1.c.001t.tu                   1.c.052t.forwprop2    1.c.086t.loop
1.c.003t.original             1.c.054t.alias        1.c.087t.loopinit
1.c.004t.gimple               1.c.055t.retslot      1.c.088t.copyprop4
1.c.006t.vcg                  1.c.056t.phiprop      1.c.089t.dceloop1
1.c.007t.useless              1.c.057t.fre          1.c.090t.lim
1.c.010t.lower                1.c.058t.copyprop2    1.c.093t.sccp
1.c.011t.ehopt                1.c.059t.mergephi2    1.c.094t.empty
1.c.012t.eh                   1.c.061t.dce1         1.c.099t.ivcanon
1.c.013t.cfg                  1.c.062t.cselim       1.c.104t.cunroll
1.c.015t.veclower             1.c.063t.ifcombine    1.c.107t.ivopts
1.c.021t.cleanup_cfg          1.c.064t.phiopt1      1.c.108t.loopdone
1.c.023t.ssa                  1.c.066t.ch           1.c.111t.reassoc2
1.c.024t.early_optimizations  1.c.068t.cplxlower    1.c.113t.dom2
1.c.025t.einline2             1.c.069t.sra          1.c.114t.phicprop2
1.c.026t.copyrename1          1.c.070t.copyrename3  1.c.115t.cddce2
1.c.027t.ccp1                 1.c.071t.dom1         1.c.117t.dse2
1.c.028t.forwprop1            1.c.072t.phicprop1    1.c.118t.forwprop4
1.c.029t.addressables1        1.c.073t.dse1         1.c.119t.phiopt3
1.c.030t.esra                 1.c.074t.reassoc1     1.c.121t.copyrename4
1.c.031t.copyprop1            1.c.075t.dce2         1.c.122t.uncprop
1.c.032t.mergephi1            1.c.076t.forwprop3    1.c.123t.optimized
1.c.033t.cddce1               1.c.077t.phiopt2      1.c.124t.nrv
1.c.034t.sdse                 1.c.078t.objsz        1.c.125t.blocks
1.c.036t.switchconv           1.c.079t.ccp3         1.c.126t.final_cleanup
1.c.037t.profile              1.c.080t.copyprop3    1.c.203t.statistics
1.c.038t.release_ssa          1.c.081t.fab          1.s
1.c.048t.addressables2        1.c.082t.sincos       a.out
1.c.049t.copyrename2          1.c.083t.crited

But here, we tried to see the differences, until 1.c.027t.ccp1, the output
for the following source 1.c
#include
int main()

{
        int a=5;
        int b;
        b=a;
        printf("the number is :%d",b);
}

was 1.c.026t.copyrename1
;; Function main (main)

main ()
{
  int b;
  int a;

:
  a_2 = b_1(D);
  return;

}
but in 1.c.027t.ccp1, the output doesnot contain the actual assignment b=a.
;; Function main (main)

main ()
{
  int b;
  int a;

:
  return;

}

We want to know, without b=a, how is it generating the final code for b=a

Kindly help

-- 
View this message in context: http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24863416.html
Sent from the gcc - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: regarding optimization options in phase ordering
  2009-08-07 11:53 regarding optimization options in phase ordering pms
@ 2009-08-07 12:34 ` Richard Guenther
  2009-08-07 13:11   ` pms
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Guenther @ 2009-08-07 12:34 UTC (permalink / raw)
  To: pms; +Cc: gcc

On Fri, Aug 7, 2009 at 1:50 PM, pms<pmshiva@gmail.com> wrote:
>
> Hi,
>     We've a problem here. we were trying to use cc1 with & without -O
> option to verify the optimizations happening in our sample code. these r the
> list of outputs after each compilation
> without -O
> pms@Shiva:~/Desktop/Compilers/GCC/build/test$ ls
> 1.c                1.c.011t.ehopt        1.c.038t.release_ssa
> 1.c.001t.tu        1.c.012t.eh           1.c.123t.optimized
> 1.c.003t.original  1.c.013t.cfg          1.c.125t.blocks
> 1.c.004t.gimple    1.c.014t.cplxlower0   1.c.126t.final_cleanup
> 1.c.006t.vcg       1.c.015t.veclower     1.c.203t.statistics
> 1.c.007t.useless   1.c.021t.cleanup_cfg  1.s
> 1.c.010t.lower     1.c.023t.ssa          a.out
>
> with -O
>
> 1.c                           1.c.051t.ccp2         1.c.085t.sink
> 1.c.001t.tu                   1.c.052t.forwprop2    1.c.086t.loop
> 1.c.003t.original             1.c.054t.alias        1.c.087t.loopinit
> 1.c.004t.gimple               1.c.055t.retslot      1.c.088t.copyprop4
> 1.c.006t.vcg                  1.c.056t.phiprop      1.c.089t.dceloop1
> 1.c.007t.useless              1.c.057t.fre          1.c.090t.lim
> 1.c.010t.lower                1.c.058t.copyprop2    1.c.093t.sccp
> 1.c.011t.ehopt                1.c.059t.mergephi2    1.c.094t.empty
> 1.c.012t.eh                   1.c.061t.dce1         1.c.099t.ivcanon
> 1.c.013t.cfg                  1.c.062t.cselim       1.c.104t.cunroll
> 1.c.015t.veclower             1.c.063t.ifcombine    1.c.107t.ivopts
> 1.c.021t.cleanup_cfg          1.c.064t.phiopt1      1.c.108t.loopdone
> 1.c.023t.ssa                  1.c.066t.ch           1.c.111t.reassoc2
> 1.c.024t.early_optimizations  1.c.068t.cplxlower    1.c.113t.dom2
> 1.c.025t.einline2             1.c.069t.sra          1.c.114t.phicprop2
> 1.c.026t.copyrename1          1.c.070t.copyrename3  1.c.115t.cddce2
> 1.c.027t.ccp1                 1.c.071t.dom1         1.c.117t.dse2
> 1.c.028t.forwprop1            1.c.072t.phicprop1    1.c.118t.forwprop4
> 1.c.029t.addressables1        1.c.073t.dse1         1.c.119t.phiopt3
> 1.c.030t.esra                 1.c.074t.reassoc1     1.c.121t.copyrename4
> 1.c.031t.copyprop1            1.c.075t.dce2         1.c.122t.uncprop
> 1.c.032t.mergephi1            1.c.076t.forwprop3    1.c.123t.optimized
> 1.c.033t.cddce1               1.c.077t.phiopt2      1.c.124t.nrv
> 1.c.034t.sdse                 1.c.078t.objsz        1.c.125t.blocks
> 1.c.036t.switchconv           1.c.079t.ccp3         1.c.126t.final_cleanup
> 1.c.037t.profile              1.c.080t.copyprop3    1.c.203t.statistics
> 1.c.038t.release_ssa          1.c.081t.fab          1.s
> 1.c.048t.addressables2        1.c.082t.sincos       a.out
> 1.c.049t.copyrename2          1.c.083t.crited
>
> But here, we tried to see the differences, until 1.c.027t.ccp1, the output
> for the following source 1.c
> #include
> int main()
>
> {
>        int a=5;
>        int b;
>        b=a;
>        printf("the number is :%d",b);
> }
>
> was 1.c.026t.copyrename1
> ;; Function main (main)
>
> main ()
> {
>  int b;
>  int a;
>
> :
>  a_2 = b_1(D);
>  return;
>
> }
> but in 1.c.027t.ccp1, the output doesnot contain the actual assignment b=a.
> ;; Function main (main)
>
> main ()
> {
>  int b;
>  int a;
>
> :
>  return;
>
> }
>
> We want to know, without b=a, how is it generating the final code for b=a

Nothing.  Because it's a dead statement.

Richard.

> Kindly help
>
> --
> View this message in context: http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24863416.html
> Sent from the gcc - Dev mailing list archive at Nabble.com.
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: regarding optimization options in phase ordering
  2009-08-07 12:34 ` Richard Guenther
@ 2009-08-07 13:11   ` pms
  2009-08-10 11:20     ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: pms @ 2009-08-07 13:11 UTC (permalink / raw)
  To: gcc


thanks, But b=a is a assignment statement. It is doing some memory operations
isn't it. Assuming b=a is a dead statement, how r the following i386
assembly statements generated
 pushl   %ebp
        movl    %esp, %ebp
        andl    $-16, %esp
        subl    $16, %esp
        movl    $5, 4(%esp)
        movl    $.LC0, (%esp)
        call    printf

pls reply


Richard Guenther-2 wrote:
> 
> On Fri, Aug 7, 2009 at 1:50 PM, pms<pmshiva@gmail.com> wrote:
>>
>> Hi,
>>     We've a problem here. we were trying to use cc1 with & without -O
>> option to verify the optimizations happening in our sample code. these r
>> the
>> list of outputs after each compilation
>> without -O
>> pms@Shiva:~/Desktop/Compilers/GCC/build/test$ ls
>> 1.c                1.c.011t.ehopt        1.c.038t.release_ssa
>> 1.c.001t.tu        1.c.012t.eh           1.c.123t.optimized
>> 1.c.003t.original  1.c.013t.cfg          1.c.125t.blocks
>> 1.c.004t.gimple    1.c.014t.cplxlower0   1.c.126t.final_cleanup
>> 1.c.006t.vcg       1.c.015t.veclower     1.c.203t.statistics
>> 1.c.007t.useless   1.c.021t.cleanup_cfg  1.s
>> 1.c.010t.lower     1.c.023t.ssa          a.out
>>
>> with -O
>>
>> 1.c                           1.c.051t.ccp2         1.c.085t.sink
>> 1.c.001t.tu                   1.c.052t.forwprop2    1.c.086t.loop
>> 1.c.003t.original             1.c.054t.alias        1.c.087t.loopinit
>> 1.c.004t.gimple               1.c.055t.retslot      1.c.088t.copyprop4
>> 1.c.006t.vcg                  1.c.056t.phiprop      1.c.089t.dceloop1
>> 1.c.007t.useless              1.c.057t.fre          1.c.090t.lim
>> 1.c.010t.lower                1.c.058t.copyprop2    1.c.093t.sccp
>> 1.c.011t.ehopt                1.c.059t.mergephi2    1.c.094t.empty
>> 1.c.012t.eh                   1.c.061t.dce1         1.c.099t.ivcanon
>> 1.c.013t.cfg                  1.c.062t.cselim       1.c.104t.cunroll
>> 1.c.015t.veclower             1.c.063t.ifcombine    1.c.107t.ivopts
>> 1.c.021t.cleanup_cfg          1.c.064t.phiopt1      1.c.108t.loopdone
>> 1.c.023t.ssa                  1.c.066t.ch           1.c.111t.reassoc2
>> 1.c.024t.early_optimizations  1.c.068t.cplxlower    1.c.113t.dom2
>> 1.c.025t.einline2             1.c.069t.sra          1.c.114t.phicprop2
>> 1.c.026t.copyrename1          1.c.070t.copyrename3  1.c.115t.cddce2
>> 1.c.027t.ccp1                 1.c.071t.dom1         1.c.117t.dse2
>> 1.c.028t.forwprop1            1.c.072t.phicprop1    1.c.118t.forwprop4
>> 1.c.029t.addressables1        1.c.073t.dse1         1.c.119t.phiopt3
>> 1.c.030t.esra                 1.c.074t.reassoc1     1.c.121t.copyrename4
>> 1.c.031t.copyprop1            1.c.075t.dce2         1.c.122t.uncprop
>> 1.c.032t.mergephi1            1.c.076t.forwprop3    1.c.123t.optimized
>> 1.c.033t.cddce1               1.c.077t.phiopt2      1.c.124t.nrv
>> 1.c.034t.sdse                 1.c.078t.objsz        1.c.125t.blocks
>> 1.c.036t.switchconv           1.c.079t.ccp3        
>> 1.c.126t.final_cleanup
>> 1.c.037t.profile              1.c.080t.copyprop3    1.c.203t.statistics
>> 1.c.038t.release_ssa          1.c.081t.fab          1.s
>> 1.c.048t.addressables2        1.c.082t.sincos       a.out
>> 1.c.049t.copyrename2          1.c.083t.crited
>>
>> But here, we tried to see the differences, until 1.c.027t.ccp1, the
>> output
>> for the following source 1.c
>> #include
>> int main()
>>
>> {
>>        int a=5;
>>        int b;
>>        b=a;
>>        printf("the number is :%d",b);
>> }
>>
>> was 1.c.026t.copyrename1
>> ;; Function main (main)
>>
>> main ()
>> {
>>  int b;
>>  int a;
>>
>> :
>>  a_2 = b_1(D);
>>  return;
>>
>> }
>> but in 1.c.027t.ccp1, the output doesnot contain the actual assignment
>> b=a.
>> ;; Function main (main)
>>
>> main ()
>> {
>>  int b;
>>  int a;
>>
>> :
>>  return;
>>
>> }
>>
>> We want to know, without b=a, how is it generating the final code for b=a
> 
> Nothing.  Because it's a dead statement.
> 
> Richard.
> 
>> Kindly help
>>
>> --
>> View this message in context:
>> http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24863416.html
>> Sent from the gcc - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24864601.html
Sent from the gcc - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: regarding optimization options in phase ordering
  2009-08-07 13:11   ` pms
@ 2009-08-10 11:20     ` Ian Lance Taylor
  2009-08-10 13:00       ` pms
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2009-08-10 11:20 UTC (permalink / raw)
  To: pms; +Cc: gcc

pms <pmshiva@gmail.com> writes:

> thanks, But b=a is a assignment statement. It is doing some memory operations
> isn't it. Assuming b=a is a dead statement, how r the following i386
> assembly statements generated
>  pushl   %ebp
>         movl    %esp, %ebp
>         andl    $-16, %esp
>         subl    $16, %esp
>         movl    $5, 4(%esp)
>         movl    $.LC0, (%esp)
>         call    printf

The first four statements set up the stack.  The last three do the
printf statement.

What is your real question?

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: regarding optimization options in phase ordering
  2009-08-10 11:20     ` Ian Lance Taylor
@ 2009-08-10 13:00       ` pms
  2009-08-10 13:08         ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: pms @ 2009-08-10 13:00 UTC (permalink / raw)
  To: gcc


Thanx Ian,

My question is as follwos

We've a problem here. we were trying to use cc1 with & without -O option to
verify the optimizations happening in our sample code. 
the sample code is given below
file name : 1.c
 #include
 int main() 
{ int a=5; 
int b; 
b=a; 
printf("the number is :%d",b); }
Here, in 1.c.026t.copyrename1, we get the following output

1.c.026t.copyrename1
 ;; Function main (main) 
main ()
 { int b; int a; : a_2 = b_1(D); return; }
 but in 1.c.027t.ccp1, the output does not contain the actual assignment
b=a. 
;; Function main (main)
 main () 
{ int b; int a; : return; }
 We want to know, without b=a, how is it generating the following final code
for b=a 
pushl   %ebp
>         movl    %esp, %ebp
>         andl    $-16, %esp
>         subl    $16, %esp
>         movl    $5, 4(%esp)
>         movl    $.LC0, (%esp)
>         call    printf
Kindly help 















> thanks, But b=a is a assignment statement. It is doing some memory
> operations
> isn't it. Assuming b=a is a dead statement, how r the following i386
> assembly statements generated
>  pushl   %ebp
>         movl    %esp, %ebp
>         andl    $-16, %esp
>         subl    $16, %esp
>         movl    $5, 4(%esp)
>         movl    $.LC0, (%esp)
>         call    printf

The first four statements set up the stack.  The last three do the
printf statement.

What is your real question?

Ian



-- 
View this message in context: http://www.nabble.com/regarding-optimization-options-in-phase-ordering-tp24863416p24898021.html
Sent from the gcc - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: regarding optimization options in phase ordering
  2009-08-10 13:00       ` pms
@ 2009-08-10 13:08         ` Ian Lance Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2009-08-10 13:08 UTC (permalink / raw)
  To: pms; +Cc: gcc

pms <pmshiva@gmail.com> writes:

> My question is as follwos
>
> We've a problem here. we were trying to use cc1 with & without -O option to
> verify the optimizations happening in our sample code. 
> the sample code is given below
> file name : 1.c
>  #include
>  int main() 
> { int a=5; 
> int b; 
> b=a; 
> printf("the number is :%d",b); }
> Here, in 1.c.026t.copyrename1, we get the following output
>
> 1.c.026t.copyrename1
>  ;; Function main (main) 
> main ()
>  { int b; int a; : a_2 = b_1(D); return; }
>  but in 1.c.027t.ccp1, the output does not contain the actual assignment
> b=a. 
> ;; Function main (main)
>  main () 
> { int b; int a; : return; }
>  We want to know, without b=a, how is it generating the following final code
> for b=a 
> pushl   %ebp
>>         movl    %esp, %ebp
>>         andl    $-16, %esp
>>         subl    $16, %esp
>>         movl    $5, 4(%esp)
>>         movl    $.LC0, (%esp)
>>         call    printf

No code is generated for the statement "b=a".  In effect, the program is
optimized into
  printf("the number is :%d",5);
as that is equivalent to the original program.

This is a very simple compiler optimization.  Please consider taking
future questions about code generation to the mailing list
gcc-help@gcc.gnu.org.  The mailing list gcc@gcc.gnu.org is for gcc
developers.  Thanks.

Ian


>> thanks, But b=a is a assignment statement. It is doing some memory
>> operations
>> isn't it. Assuming b=a is a dead statement, how r the following i386
>> assembly statements generated
>>  pushl   %ebp
>>         movl    %esp, %ebp
>>         andl    $-16, %esp
>>         subl    $16, %esp
>>         movl    $5, 4(%esp)
>>         movl    $.LC0, (%esp)
>>         call    printf
>
> The first four statements set up the stack.  The last three do the
> printf statement.
>
> What is your real question?
>
> Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-10 11:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-07 11:53 regarding optimization options in phase ordering pms
2009-08-07 12:34 ` Richard Guenther
2009-08-07 13:11   ` pms
2009-08-10 11:20     ` Ian Lance Taylor
2009-08-10 13:00       ` pms
2009-08-10 13:08         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).