c++visual-studiocompiler-optimization

Turn off Inline Expansion but let Optimization be there


While doing performance analysis, I have encountered a problem where some functions are not being detected since the compiler is inlining them as part of /Ox optimisation.

So the problem is : How to use set the /Ob1 or /Ob0 switch but let the /Ox switch remain on.??? the Ox switch as I figure automatically turns the Ob switch to /Ob2 ??

See: http://msdn.microsoft.com/en-us/library/8f8h5cxt(v=vs.71).aspx


Solution

  • From http://msdn.microsoft.com/en-us/library/59a3b321%28v=vs.71%29.aspx /Ox is the same as:

    /Obn, where n = 2
    /Og
    /Oi
    /Os, /O, /Ot
    /Oy
    

    So I would suggest:

    /Ob0 /Og /Oi /Os /O /Ot /Oy
    

    (of course you can change /Ob0 to /Ob1 if that's what you need).