[PATCH] D54244: [HotColdSplitting] Refine definition of unlikelyExecuted
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 14 12:14:27 PST 2018
vsk added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/HotColdSplitting.cpp:106-120
+ 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) && !CI->hasFnAttr(Attribute::Cold))
+ return false;
----------------
junbuml wrote:
>
>
> It seems that the case below will be ended up with warm. Don't we need to see this case as cold?
>
> ```
> BB:
> .....
> call void @sink()
> ......
> tail call void @longjmp(%struct.__jmp_buf_tag* %1, i32 0)
> unreachable
>
> declare void @sink() cold
> declare void @longjmp(%struct.__jmp_buf_tag*, i32) noreturn nounwind
> ```
Thanks for pointing this out.
https://reviews.llvm.org/D54244
More information about the llvm-commits
mailing list