[PATCH] D101231: [RFC][InlineCost] Don't count the cost of truly exceptionally unlikely blocks (PR50099)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 24 10:29:43 PDT 2021


lebedev.ri added a reviewer: chandlerc.
lebedev.ri added a comment.

In D101231#2714564 <https://reviews.llvm.org/D101231#2714564>, @lebedev.ri wrote:

> In D101231#2714557 <https://reviews.llvm.org/D101231#2714557>, @nikic wrote:
>
>> Possibly I'm misunderstanding what is proposed here, but aren't these kind of very rarely executed blocks exactly what we do **not** want to inline? This would make sense in the context of something like partial inlining, where we could inline the hot parts without the cold parts (and thus not cost the cold parts), but for regular inlining this means we duplicate cold code, increasing code size and icache pressure.
>
> Is that not what i asked in the description?
>
> Right now i'm simply enumerating possible solutions in hope that at least one will fit.

FWIW what i'm doing here is actually apparently already suggested in a FIXME:

  bool CallAnalyzer::visitUnreachableInst(UnreachableInst &I) {
    // FIXME: It might be reasonably to discount the cost of instructions leading
    // to unreachable as they have the lowest possible impact on both runtime and
    // code size.
    return true; // No actual code is needed for unreachable.
  }

from rL197215 <https://reviews.llvm.org/rL197215> @ https://github.com/llvm/llvm-project/blob/269b335bd7332cd0d13451260d408dc9fcbcb5b1/llvm/lib/Analysis/InlineCost.cpp#L2066-L2071


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101231/new/

https://reviews.llvm.org/D101231



More information about the llvm-commits mailing list