In lieu of the change D115907 which introduces a new warning Wmisnoexpect, I introduce a new warning, Wmisnoinline to print potential wrong usage of noinline attribute with functions. NoInline functions should ideally not be hot as per profile summary. If they are hot, we could print a warning to inform user to think again about marking of their annotation as it may happen that maybe, overtime functions which a user might think is cold/slow may turn hot and compiler may benefit from inlining them.
The WMisNoInline only works if profile data is attached or else throws a warning and has no effect. It emits a warning if the following two conditions are met:
- If a noinline function is hotter than fdiagnostics-misnoinline-percentile-threshold (by default set to 99%) as per PSI analysis.
- There was a possibility of Inlining that function in CGSCC Inliner pass(based on cost-threshold calculation).
The change was tested on HHVM and we found out 14 extremely hot noinline functions which were within 50 percentile hotness and ~110 mildly hot noinline functions within 99 percentile hotness based on PSI analysis.
Test Plan: ninja check all
llvm-lit --show-all MisNoInline.cpp
llvm-lit --show-all MisNoInline_LowThreshold.cpp
llvm-lit --show-all MisNoInline.ll