[PATCH] D13304: Avoid inlining in throw statement
Jun Bum Lim via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 3 11:24:12 PST 2015
junbuml added a comment.
The basic idea of this change is to avoid inlining callsites invoked in exception handling regions (EHR) so that we can reduce code size blow-up in very cold regions and indirectly increase inline opportunities for functions containing exception handling code.
I think the best way to implement this is influencing to the inline heuristic by smoothly decreasing the threshold for the callsites in EHR. From this perspective, Attribute::Cold seems to be the right attribute to be added. However, the current ColdThreshold is still not tuned yet (r200898) and too high to conservatively perform inlining in EHR.
As a work-around, in my current implementation, both Cold and NoInline are added to the callsites. I understand that the NoInline is somewhat strong attribute to be added, but I don't think there is any negative impact on performance unless the execution logic really depends on exception handling flows, which is rare. The only downsides I can think of is the case where the callee is very small so that inlining it is profitable for size, but the impact must be minor.
If using NoInline is too strong to use, another work-around could be introducing a new attribute something like "ColdInEHR", and then we decrease the inline threshold for the callsites marked with this attribute. OptSizeThreshold(75) could be considered to be a candidate for the default threshold.
Unless there is a strong objection about the basic idea, I want to move forward and close this issue as soon as possible. Please let me know any opinion.
http://reviews.llvm.org/D13304
More information about the cfe-commits
mailing list