<div dir="rtl"><div dir="ltr">Thanks!</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-11-30 1:45 GMT+02:00 Sanjoy Das via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
Craig Topper via llvm-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Replaced in r254260.<br>
<br>
FWIW, there's also this code in ScalarEvolution.cpp that does similar.<br>
<br>
   // If FlagNSW is true and all the operands are non-negative, infer FlagNUW.<br>
   auto IsKnownNonNegative =<br>
     std::bind(std::mem_fn(&ScalarEvolution::isKnownNonNegative), SE, _1);<br>
<br>
   if (SignOrUnsignWrap == SCEV::FlagNSW &&<br>
       std::all_of(Ops.begin(), Ops.end(), IsKnownNonNegative))<br>
     Flags =<br>
         ScalarEvolution::setFlags(Flags, (SCEV::NoWrapFlags)SignOrUnsignMask);<br>
</blockquote>
<br></span>
I had added that code some time back, but I agree that a lambda is much more readable.  Fixed in r254276.<br>
<br>
-- Sanjoy<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
<br>
On Sun, Nov 29, 2015 at 7:20 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a> <mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>>> wrote:<br>
<br>
<br>
    On Nov 29, 2015 3:28 AM, "Alex Bradbury via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br></span><span class="">
    <mailto:<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>>> wrote:<br>
     ><br>
     > On 29 November 2015 at 04:37, Craig Topper via llvm-commits<br></span><div><div class="h5">
     > <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a> <mailto:<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>>> wrote:<br>
     > > Author: ctopper<br>
     > > Date: Sat Nov 28 22:37:11 2015<br>
     > > New Revision: 254242<br>
     > ><br>
     > > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=254242&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=254242&view=rev</a><br>
    <<a href="http://llvm.org/viewvc/llvm-project?rev=254242&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=254242&view=rev</a>><br>
     > > Log:<br>
     > > [SelectionDAG] Use std::any_of instead of a manually coded loop. NFC<br>
     > ><br>
     > > Modified:<br>
     > >     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
     > ><br>
     > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
     > > URL:<br>
    <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=254242&r1=254241&r2=254242&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=254242&r1=254241&r2=254242&view=diff</a><br>
    <<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=254242&r1=254241&r2=254242&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=254242&r1=254241&r2=254242&view=diff</a>><br>
     > > ==============================================================================<br>
     > > --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)<br>
     > > +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Nov 28 22:37:11 2015<br>
     > > @@ -11317,15 +11317,11 @@ bool DAGCombiner::MergeConsecutiveStores<br>
     > >          break;<br>
     > >      }<br>
     > ><br>
     > > -    bool Alias = false;<br>
     > >      // Check if this store interferes with any of the loads that we found.<br>
     > > -    for (unsigned ld = 0, lde = AliasLoadNodes.size(); ld < lde; ++ld)<br>
     > > -      if (isAlias(AliasLoadNodes[ld], StoreNodes[i].MemNode)) {<br>
     > > -        Alias = true;<br>
     > > -        break;<br>
     > > -      }<br>
     > > -    // We found a load that alias with this store. Stop the sequence.<br>
     > > -    if (Alias)<br>
     > > +    // If we find a load that alias with this store. Stop the sequence.<br>
     > > +    if (std::any_of(AliasLoadNodes.begin(), AliasLoadNodes.end(),<br>
     > > +                    std::bind(std::mem_fn(&DAGCombiner::isAlias), this,<br>
     > > +                              std::placeholders::_1, StoreNodes[i].MemNode)))<br>
     ><br>
     > I know this comes partly down to personal preference, but I can't help<br>
     > but think this would be more readable with a lambda (like the recent<br>
     > cleanups to CodeGenDAGPatterns by you and David Blaikie).<br>
<br>
    Yeah, that's what the Google style guide has suggested (that bind just isn't worth it & lambdas should just be used<br>
    instead, even in the few cases where bind might be lexically shorter) & I tend to agree with it, but not totally<br>
    fussed, personally, if people want to play with bind and see how it feels<br>
<br>
     ><br>
     > Alex<br>
     > _______________________________________________<br>
     > llvm-commits mailing list<br></div></div>
     > <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a> <mailto:<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>><span class=""><br>
     > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
<br>
<br>
<br>
--<br>
~Craig<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</span></blockquote><div class="HOEnZb"><div class="h5">
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>