[PATCH] D54244: [HotColdSplitting] Refine definition of unlikelyExecuted

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 11:40:35 PST 2018


junbuml added a comment.

Thanks for the update. Just one minor comment inlined.



================
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;
----------------


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
```


https://reviews.llvm.org/D54244





More information about the llvm-commits mailing list