Hi
I have been looking at the intermediate representation (IR) dumped by gcc
(4.4.5, cross compiled for powerpc) through the switch -fdump-tree-all. 

An experiment I carried out was to manually make the IR compilable, i.e.
write a C program with the same control flow (using "if" and "goto") and
variable usage as in the IR. I compiled this program and found that the
binary was quite different from the one generated by compiling the original
program. In the former case the "for" loop gets unrolled whereas in the
latter it doesn't. Can some one please advise why they are different?

I am attaching the relevant files (zipped archive).
test1.c - Original program
test1_IR.c - The compilable form of the IR.
test1.c.126t.final_cleanup - What I believe is the final step of the front
end optimisations carried out by gcc (this was one of the files output using
-fdump-tree-all)
test1_objdump - Object dump of executable generated from test1.c
test1_IR_opt_objdump - Object dump of executable generated from test1_IR.c

Command used to dump IR:
powerpc-elf-gcc -pedantic -Wcomment -fno-asm -fsigned-char -W -Wparentheses
-Wreturn-type -Wswitch -Wunused -Wsign-compare -Wimplicit -Wreturn-type
-Wshadow -Wpointer-arith -Wwrite-strings -Wsign-compare -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -O2 -fdump-tree-all -msim
-msoft-float -o test1.elf test1.c

Command used to compile test1_IR.c:
same options as above but without -fdump-tree-all and adding -g to generate
debugging info for gdb.

http://old.nabble.com/file/p31620771/source_files.zip source_files.zip 
-- 
View this message in context: 
http://old.nabble.com/Differences-in-optimisations-on-different-versions-of-same-program-tp31620771p31620771.html
Sent from the gcc - Dev mailing list archive at Nabble.com.

Reply via email to