[PATCH] D53887: [HotColdSplitting] Outline more than once per function

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 12:55:16 PST 2018


vsk added a comment.

In https://reviews.llvm.org/D53887#1290571, @junbuml wrote:

> > IMHO the right fix is to not treat noreturn calls as cold (also as a follow-up).
>
> I'm not sure if handling noreturn is a right fix. A block containing exit(0) will have "unreachable", so it must be still considered as a cold block even after removing noreturn from unlikelyExecuted().


I had in mind:

  if (blockEndsInUnreachable(BB)) {
    // Calls to noreturn functions are followed by an unreachable inst, but
    // the call itself may be warm (e.g. longjmp, or exit).
    if (auto *CI =
            dyn_cast_or_null<CallInst>(BB.getTerminator()->getPrevNode()))
      if (CI->hasFnAttr(Attribute::NoReturn))
        return false;
    return true;
  }


https://reviews.llvm.org/D53887





More information about the llvm-commits mailing list