<div dir="ltr">Hi Justin,<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 3, 2015 at 5:05 PM, Justin Bogner <span dir="ltr"><<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Alexey Samsonov <<a href="mailto:vonosmas@gmail.com">vonosmas@gmail.com</a>> writes:<br>
> Author: samsonov<br>
> Date: Wed Apr  1 20:30:10 2015<br>
> New Revision: 233881<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233881&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=233881&view=rev</a><br>
> Log:<br>
> Fix a bug indicated by -fsanitize=shift-exponent.<br>
<br>
</span>I noticed a significant performance regression Benchmarks/Shootout/sieve<br>
after this change. I suspect this isn't quite the right fix for the<br>
undefined behaviour.<br>
<br>
You can see the performance jump in lnt here:<br>
<br>
    <a href="http://llvm-lnt.herokuapp.com/db_default/v4/nts/graph?plot.0=3.794.3&highlight_run=9976" target="_blank">http://llvm-lnt.herokuapp.com/db_default/v4/nts/graph?plot.0=3.794.3&highlight_run=9976</a><br>
<br>
There's a big regression between r233879 and r233882. This is the only<br>
interesting change in that range.<br>
<span class=""><br>
> Modified:<br>
>     llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp?rev=233881&r1=233880&r2=233881&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp?rev=233881&r1=233880&r2=233881&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp Wed Apr  1 20:30:10 2015<br>
> @@ -320,7 +320,7 @@ bool llvm::UnrollRuntimeLoopProlog(Loop<br>
>    // This constraint lets us deal with an overflowing trip count easily; see the<br>
>    // comment on ModVal below.  This check is equivalent to `Log2(Count) <<br>
>    // BEWidth`.<br>
> -  if (static_cast<uint64_t>(Count) > (1ULL << BEWidth))<br>
> +  if (BEWidth < 64 && static_cast<uint64_t>(Count) > (1ULL << BEWidth))<br>
<br>
</span>To match what the comment says we're doing, I guess we want:<br>
<br>
  if (BEWidth >= 64 || static_cast<uint64_t>(Count) > (1ULL << BEWidth))<br>
<br>
since Log2(Count) is guaranteed to be less than 64.<br></blockquote><div><br></div><div>... but if BEWidth is 64, than Count can never be greater than 1ULL << BEWidth, and we should *not* return false.</div><div>Note that the comment doesn't match the current code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
>      return false;<br>
><br>
>    // If this loop is nested, then the loop unroller changes the code in<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">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><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>