[PATCH] D69257: Outline non returning functions unless a longjmp

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 14:41:42 PDT 2019


hiraditya updated this revision to Diff 225958.

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

https://reviews.llvm.org/D69257

Files:
  llvm/lib/Transforms/IPO/HotColdSplitting.cpp


Index: llvm/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -117,8 +117,12 @@
   if (blockEndsInUnreachable(BB)) {
     if (auto *CI =
             dyn_cast_or_null<CallInst>(BB.getTerminator()->getPrevNode()))
-      if (CI->hasFnAttr(Attribute::NoReturn))
-        return false;
+      if (CI->hasFnAttr(Attribute::NoReturn)) {
+        if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI))
+          return II->getIntrinsicID() != Intrinsic::longjmp;
+        CallSite CS(CI);
+        return !CS.getCalledFunction()->getName().startswith("longjmp");
+      }
     return true;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69257.225958.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191021/b03f479e/attachment.bin>


More information about the llvm-commits mailing list