Search code examples
c++visual-c++visual-studio-2017inline

Functions had inline decision re-evaluated but remain unchanged


I'm working with C++ project. When I build a project in visual Studio Community 2017, a Visual studio C++ project generates a "1 functions had inline decision re-evaluated but remain unchanged".

So, What does mean by "1 functions had inline decision re-evaluated but remain unchanged"?

Does visual studio Community 2017 compiling my changes?


Solution

  • Traditionally, the decision about what files to build after a change was based on the timestamp of each .cpp file and of its #included dependencies. If you touched a .h included by everyone in the project (even just to add a comment), all the files get rebuilt.

    Recent versions of VC++ have a Minimal Rebuild feature, that works at a smaller granularity: each function in a dependent .cpp file is re-examined, and, if the AST-level input to the compiler is unchanged, the code generated in the previous compilation for that function is recycled (see also this answer).

    Now, and here I'm speculating a bit, it may happen that the code generated in the previous run is legally ok, but something has changed about the inputs to the inlining heuristics.

    For example, imagine that there's some helper function foo that shrunk quite a bit from the last compilation, and it became eligible for inlining: the code generated for all the functions that call foo (which called it as a "regular" function, without inlining) can in fact be legally recycled and the resulting executable will run ok, although the compiler, if building everything from scratch, would now probably inline foo for better performance.

    With the minimal rebuild feature enabled, here the compiler privileges minimal rebuild time over best performance of the executable (and warns you about this).

    So, that message is generally nothing to worry about during the regular "compile-link-run-debug" cycle - if you are not investigating specifically performance issues, just enjoy your reduced compilation times.

    OTOH, if you need to make a "clean" or very-best performance release, either disable the minimal rebuild option, or just clean the build and rebuild from scratch; minimal rebuild will not kick in (as the files from the previous compilation will have been deleted) and you'll get the best performance from the generated executable.