2 ms·
Last I checked, gcc in PGO mode can basically do things like "-O2 for hot code, -Os for everything else". MSVC in PGO/LTO mode will do all sorts of exciting th
by bzbarsky 9y ago
Last I checked, gcc in PGO mode can basically do things like "-O2 for hot code, -Os for everything else".
MSVC in PGO/LTO mode will do all sorts of exciting things. For example, in hot code it will detect that a virtual function call is always or nearly always happening with the same vtable pointer and emit a guard on the vtable pointer followed by an inlining of that one particular implementation (with a fallback to a normal virtual call if the guard fails). I'm pretty sure it doesn't do this for all virtual function calls in the program. Even if it only does it for ones where it has "enough data", that would bias towards the hot ones.