[llvm] r237711 - use range-based for-loop

Sanjay Patel spatel at rotateright.com
Tue May 19 13:15:06 PDT 2015


Thanks for the pointer (pun intended). :)
Fixed with r237719.

On Tue, May 19, 2015 at 2:05 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Tue, May 19, 2015 at 11:24 AM, Sanjay Patel <spatel at rotateright.com>
> wrote:
>
>> Author: spatel
>> Date: Tue May 19 13:24:33 2015
>> New Revision: 237711
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=237711&view=rev
>> Log:
>> use range-based for-loop
>>
>> Modified:
>>     llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=237711&r1=237710&r2=237711&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue May 19
>> 13:24:33 2015
>> @@ -8280,12 +8280,9 @@ SDValue DAGCombiner::visitFDIV(SDNode *N
>>
>>      SmallVector<SDNode *, 4> Users;
>>      // Find all FDIV users of the same divisor.
>> -    for (SDNode::use_iterator UI = N1.getNode()->use_begin(),
>> -                              UE = N1.getNode()->use_end();
>> -         UI != UE; ++UI) {
>> -      SDNode *User = UI.getUse().getUser();
>> -      if (User->getOpcode() == ISD::FDIV && User->getOperand(1) == N1)
>> -        Users.push_back(User);
>> +    for (auto U : N1->uses()) {
>> +      if (U->getOpcode() == ISD::FDIV && U->getOperand(1) == N1)
>> +        Users.push_back(U);
>>      }
>>
>>      if (TLI.combineRepeatedFPDivisors(Users.size())) {
>> @@ -8294,7 +8291,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N
>>        SDValue Reciprocal = DAG.getNode(ISD::FDIV, DL, VT, FPOne, N1);
>>
>>        // Dividend / Divisor -> Dividend * Reciprocal
>> -      for (auto &U : Users) {
>> +      for (auto U : Users) {
>>
>
> Pleas use "auto *" for pointer types, rather than straight "auto" - makes
> it clear there's no deep copying happening, etc. (same in the previous
> change above)
>
>
>>          if (U->getOperand(0) != FPOne) {
>>            SDValue NewNode = DAG.getNode(ISD::FMUL, SDLoc(U), VT,
>>                                          U->getOperand(0), Reciprocal);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150519/22b12bd8/attachment.html>


More information about the llvm-commits mailing list