[PATCH] D16616: Avoid inlining CallSites in unreachable-terminated block
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 09:13:58 PST 2016
On Wed, Jan 27, 2016 at 8:42 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Tue, Jan 26, 2016 at 5:43 PM, Jun Bum Lim via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> junbuml created this revision.
>> junbuml added reviewers: mcrosier, manmanren, majnemer, hfinkel, davidxl,
>> eraman.
>> junbuml added a subscriber: llvm-commits.
>> Herald added a subscriber: mcrosier.
>>
>> If the call site or the normal destination of the invoke is an
>> unreachable-terminated block, there is little point in inlining the call
>> site unless there is literally zero cost. Unlike my previous change
>> (D15289), this change specifically handle the call sites followed by
>> unreachable in the same basic block for call or in the normal destination
>> for the invoke. This change could be a reasonable first step to
>> conservatively inline call sites leading to an unreachable-terminated block
>> while BFI / BPI is not yet available in inliner.
>
>
> Not quite sure I follow - wouldn't it be possible that the function is
> noreturn? So the entry is hot but the exit is cold/dead? Or is this
> optimization change a heuristic based on the observation that this situation
> (hot entry, dead exit) doesn't happen very often in practice?
>
The change does not introduce a new heuristic but extends an existing
one. It says if the callee never returns (under the current calling
context: CS), the callsite is cold (called zero or one time).
With profile info available in the future, this heuristic can be
covered by more general profile based heuristics. It is also
possible to have more elaborate heuristic in the future to override
this simple one. For instance the called once callee has only one
callsite, and the callee actually has a very hot body that benefits
from inlining with exposed context.
David
>>
>>
>>
>> http://reviews.llvm.org/D16616
>>
>> Files:
>> lib/Analysis/InlineCost.cpp
>> test/Transforms/Inline/inline_unreachable.ll
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
More information about the llvm-commits
mailing list