<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><span>> Hm, it should be reasonable to add a test for this as well. </span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Agreed, I have a testcase, I'll upload soon.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
-Aditya<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> vsk@apple.com <vsk@apple.com> on behalf of Vedant Kumar <vsk@apple.com><br>
<b>Sent:</b> Wednesday, October 3, 2018 7:38 PM<br>
<b>To:</b> Aditya Kumar<br>
<b>Cc:</b> Vedant Kumar via llvm-commits<br>
<b>Subject:</b> Re: [llvm] r343663 - Improve static analysis of cold basic blocks</font>
<div> </div>
</div>
<meta content="text/html; charset=utf-8">
<div class="" style="word-wrap:break-word; line-break:after-white-space">Hm, it should be reasonable to add a test for this as well.
<div class=""><br class="">
</div>
<div class="">vedant<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Oct 3, 2018, at 6:36 PM, Vedant Kumar via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="OWAAutoLink" id="LPlnk111659" previewremoved="true">llvm-commits@lists.llvm.org</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class=""><span class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">Hi
 Aditya,</span>
<div class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="">
</div>
<div class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
Thanks for working on this :).<br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Oct 2, 2018, at 11:21 PM, Aditya Kumar via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="OWAAutoLink" id="LPlnk958996" previewremoved="true">llvm-commits@lists.llvm.org</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="">Author: hiraditya<br class="">
Date: Tue Oct  2 23:21:05 2018<br class="">
New Revision: 343663<br class="">
<br class="">
URL:<span class="x_Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=343663&view=rev" class="OWAAutoLink" id="LPlnk194925" previewremoved="true">http://llvm.org/viewvc/llvm-project?rev=343663&view=rev</a><br class="">
Log:<br class="">
Improve static analysis of cold basic blocks<br class="">
<br class="">
Differential Revision:<span class="x_Apple-converted-space"> </span><a href="https://reviews.llvm.org/D52704" class="OWAAutoLink" id="LPlnk911217" previewremoved="true">https://reviews.llvm.org/D52704</a><br class="">
<br class="">
Reviewers: sebpop, tejohnson, brzycki, SirishP<br class="">
Reviewed By: sebpop<br class="">
<br class="">
Modified:<br class="">
   llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp<br class="">
<br class="">
Modified: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp<br class="">
URL:<span class="x_Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp?rev=343663&r1=343662&r2=343663&view=diff" class="OWAAutoLink" id="LPlnk447011" previewremoved="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp?rev=343663&r1=343662&r2=343663&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp (original)<br class="">
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp Tue Oct  2 23:21:05 2018<br class="">
@@ -111,6 +111,18 @@ bool blockEndsInUnreachable(const BasicB<br class="">
  return succ_empty(&BB);<br class="">
}<br class="">
<br class="">
+static bool exceptionHandlingFunctions(const CallInst *CI) {<br class="">
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Could you use verb phrases for function names (see <a href="https://www.llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly" class="OWAAutoLink" id="LPlnk194844" previewremoved="true">https://www.llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly</a>)?</div>
<div class=""><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">+  auto F = CI->getCalledFunction();<br class="">
+  if (!F)<br class="">
+    return false;<br class="">
+  auto FName = F->getName();<br class="">
+  return FName == "__cxa_begin_catch" ||<br class="">
+         FName == "__cxa_free_exception" ||<br class="">
+         FName == "__cxa_allocate_exception" ||<br class="">
+         FName == "__cxa_begin_catch" ||<br class="">
+         FName == "__cxa_end_catch”;<br class="">
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Given how hot this might be, would it make sense to return early if, say, the name doesn’t begin with “__”? Ideally we’d use some sort of off-the-shelf multi-string matching function, but absent that..</div>
<div class=""><br class="">
</div>
<div class="">thanks,</div>
<div class="">vedant</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">+}<br class="">
+<br class="">
static<br class="">
bool unlikelyExecuted(const BasicBlock &BB) {<br class="">
  if (blockEndsInUnreachable(BB))<br class="">
@@ -122,7 +134,8 @@ bool unlikelyExecuted(const BasicBlock &<br class="">
    if (const CallInst *CI = dyn_cast<CallInst>(&I)) {<br class="">
      // The block is cold if it calls functions tagged as cold or noreturn.<br class="">
      if (CI->hasFnAttr(Attribute::Cold) ||<br class="">
-          CI->hasFnAttr(Attribute::NoReturn))<br class="">
+          CI->hasFnAttr(Attribute::NoReturn) ||<br class="">
+          exceptionHandlingFunctions(CI))<br class="">
        return true;<br class="">
<br class="">
      // Assume that inline assembly is hot code.<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@lists.llvm.org" class="OWAAutoLink" id="LPlnk689465" previewremoved="true">llvm-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" class="OWAAutoLink" id="LPlnk434581" previewremoved="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<span class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">llvm-commits
 mailing list</span><br class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="mailto:llvm-commits@lists.llvm.org" class="OWAAutoLink" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" id="LPlnk226190" previewremoved="true">llvm-commits@lists.llvm.org</a><br class="" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" class="OWAAutoLink" style="font-family:Helvetica; font-size:13px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" id="LPlnk769746" previewremoved="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>