<div dir="ltr">Here is my data from the last night's run of SPEC ref (the smaller the better): <div>                                              <br><div><div><span style="font-family:'courier new',monospace">                          w/o weights,  with weights,     diff</span><br>
</div><div><span style="font-family:'courier new',monospace">       400.perlbench,      1449.00,      1440.00,         0.99</span><span style="font-family:'courier new',monospace"><br></span></div><div><font face="courier new, monospace">           401.bzip2,       905.00,       834.00,         0.92</font></div>
<div><font face="courier new, monospace">             403.gcc,       743.00,       742.00,         1.00</font></div><div><font face="courier new, monospace">             429.mcf,       315.00,       338.00,         1.07</font></div>
<div><font face="courier new, monospace">           445.gobmk,       973.00,       882.00,         0.91</font></div><div><font face="courier new, monospace">           456.hmmer,      1067.00,      1007.00,         0.94</font></div>
<div><font face="courier new, monospace">           458.sjeng,      1004.00,      1044.00,         1.04</font></div><div><font face="courier new, monospace">      462.libquantum,       344.00,       398.00,         1.16</font></div>
<div><font face="courier new, monospace">         464.h264ref,      1485.00,      1277.00,         0.86</font></div><div><font face="courier new, monospace">         471.omnetpp,       580.00,       609.00,         1.05</font></div>
<div><font face="courier new, monospace">           473.astar,       575.00,       646.00,         1.12</font></div><div><font face="courier new, monospace">       483.xalancbmk,       538.00,       510.00,         0.95</font></div>
<div><font face="courier new, monospace">            433.milc,       650.00,       585.00,         0.90</font></div><div><font face="courier new, monospace">            444.namd,       592.00,       601.00,         1.02</font></div>
<div><font face="courier new, monospace">          447.dealII,       625.00,       640.00,         1.02</font></div><div><font face="courier new, monospace">          450.soplex,       333.00,       348.00,         1.05</font></div>
<div><font face="courier new, monospace">          453.povray,       493.00,       481.00,         0.98</font></div><div><font face="courier new, monospace">             470.lbm,       370.00,       380.00,         1.03</font></div>
<div><font face="courier new, monospace">         482.sphinx3,       868.00,       850.00,         0.98</font></div></div><div><br></div></div><div>It's kind of mixed.... </div><div>I've just migrated to a new machine so I don't know if the results are stable here. </div>
<div>Let me ponder on this change for a few days (after the weekend)... </div><div><br></div><div>--kcc </div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 29, 2014 at 9:06 AM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am actually surprised too :) <div>We've used branch weights in a couple of other places but not here. </div>
<div>One can easily create a benchmark where these weights will lead to a performance loss,</div>
<div>but the average SPEC numbers clearly show the overal benefit.   </div><div>Let me submit this patch once I confirm the SPEC/ref numbers (the SPEC/test numbers I saw yesterday are very nice)</div><div><br></div><div>
--kcc </div>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 29, 2014 at 1:57 AM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Adding ASan folks...</div><div><br></div>Didn't we already look at this Kostya? A bit surprised this wasn't already the case.</div>

<div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 29, 2014 at 1:24 AM, Jonas Wagner <span dir="ltr"><<a href="mailto:jonas.wagner@epfl.ch" target="_blank">jonas.wagner@epfl.ch</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Experiments on the SPEC benchmarks show that the slow path is rarely<br>
taken, and that branch weights reduce branch misses and overall runtime.<br>
---<br>
 lib/Transforms/Instrumentation/AddressSanitizer.cpp | 5 ++++-<br>
 1 file changed, 4 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
index 357b5d5..3ff0a61 100644<br>
--- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
+++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
@@ -870,8 +870,11 @@ void AddressSanitizer::instrumentAddress(Instruction *OrigIns,<br>
   TerminatorInst *CrashTerm = nullptr;<br>
<br>
   if (ClAlwaysSlowPath || (TypeSize < 8 * Granularity)) {<br>
+    // We use branch weights for the slow path check, to indicate that the slow<br>
+    // path is rarely taken. This seems to be the case for SPEC benchmarks.<br>
     TerminatorInst *CheckTerm =<br>
-        SplitBlockAndInsertIfThen(Cmp, InsertBefore, false);<br>
+        SplitBlockAndInsertIfThen(Cmp, InsertBefore, false,<br>
+            MDBuilder(*C).createBranchWeights(1, 100000));<br>
     assert(dyn_cast<BranchInst>(CheckTerm)->isUnconditional());<br>
     BasicBlock *NextBB = CheckTerm->getSuccessor(0);<br>
     IRB.SetInsertPoint(CheckTerm);<br>
<span><font color="#888888">--<br>
2.1.0<br>
</font></span><div><div><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>