This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to replace -O1 with corresponding -f's?
- From: Sergei Organov <osv at topconrd dot ru>
- To: gcc at gcc dot gnu dot org
- Date: 20 Jun 2005 17:38:40 +0400
- Subject: How to replace -O1 with corresponding -f's?
Hi,
Using gcc compiled from gcc-4_0-branch, in an attempt to see which
particular optimization option makes my test case to be mis-optimized, I
try to replace -O1 (which toggles on the problem) with corresponding set
of -fxxx optimization options. I first compile my code like this:
gcc -v -save-temps -fverbose-asm -O1 -o const.o -c const.c
then merge the cc1 command that gcc invokes to compile the preprocessed
source (as gcc doesn't seem to pass some of -f forward to cc1) with the
entire list of options taken from resulting const.s file (found at the
line " # options enabled: ..." and further), and compile using this.
In the resulting const.s file there are 2 problems:
1. "options enabled" output almost matches those from the initial (-O1)
invocation, but -floop-optimize is missing though it does exist in
the "options passed" output.
2. The resulting assembly is different from what I get with -O1 and
doesn't contain the mis-optimization I'm trying to debug though it
doesn't seem to have anything to do with loops. For reference, the
code I'm trying to compile is:
extern double const osv;
double const osv = 314314314;
double osvf() { return osv; }
Am I doing something stupid or what? How one finds out what optimization
pass misbehaves?
--
Sergei.