optimization options not working

John S. Fine johnsfine@verizon.net
Mon Mar 1 15:27:00 GMT 2010


Andrew Haley gave you a perfectly good and correct answer the previous 
time you asked that question.

If you don't understand his answer, you should ask about it.  You seem 
to be assuming he didn't understand your question.  If that were true 
(unlikely) you really haven't improved the question enough to change 
anything.

I assume you want to test a specific optimization.  You are failing 
because you didn't construct the example carefully enough.  You allowed 
the optimizer to know the result of the computation at compile time and 
you allowed it to know that the result will be ignored.  So the 
optimizer can remove the whole computation.

If you want to examine the results of a specific optimization, you must 
keep the optimizer from knowing the input values at compile time and you 
must make the optimizer think the result could be used.

If you just want to see (not benchmark) the resulting asm code, you 
don't need a complete program, just a complete function.  If the 
inputs/outputs of your computation are inputs/outputs of the function 
(that you compile separate from any call) then the optimizer can't short 
circuit the computation.


rohitgeek wrote:
>
>
> I will try to be descriptive this time .
>
>
>   
...
> Also bringing into notice the point of single instruction generation instead
> of 2 instructions (multiply and accumulate), what part of gcc will do it and
> how to proceed regarding that.
>
>
>   



More information about the Gcc-help mailing list