@@ -2570,9 +2570,8 @@ static bool provablyDisjointOr(SelectionDAG &DAG, const SDValue &N) {
2570
2570
bool PPCTargetLowering::SelectAddressEVXRegReg(SDValue N, SDValue &Base,
2571
2571
SDValue &Index,
2572
2572
SelectionDAG &DAG) const {
2573
- for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end();
2574
- UI != E; ++UI) {
2575
- if (MemSDNode *Memop = dyn_cast<MemSDNode>(*UI)) {
2573
+ for (SDNode *U : N->uses()) {
2574
+ if (MemSDNode *Memop = dyn_cast<MemSDNode>(U)) {
2576
2575
if (Memop->getMemoryVT() == MVT::f64) {
2577
2576
Base = N.getOperand(0);
2578
2577
Index = N.getOperand(1);
@@ -13205,12 +13204,12 @@ static bool findConsecutiveLoad(LoadSDNode *LD, SelectionDAG &DAG) {
13205
13204
if (isConsecutiveLS(ChainLD, LD, VT.getStoreSize(), 1, DAG))
13206
13205
return true;
13207
13206
13208
- for (SDNode::use_iterator UI = LoadRoot->use_begin(),
13209
- UE = LoadRoot->use_end(); UI != UE; ++UI)
13210
- if (((isa <MemSDNode>(*UI) &&
13211
- cast<MemSDNode>(*UI)->getChain().getNode() == LoadRoot) ||
13212
- UI->getOpcode() == ISD::TokenFactor) && !Visited.count(*UI ))
13213
- Queue.push_back(*UI );
13207
+ for (SDNode *U : LoadRoot->uses())
13208
+ if (((isa<MemSDNode>(U) &&
13209
+ cast <MemSDNode>(U)->getChain().getNode() == LoadRoot) ||
13210
+ U->getOpcode() == ISD::TokenFactor) &&
13211
+ !Visited.count(U ))
13212
+ Queue.push_back(U );
13214
13213
}
13215
13214
}
13216
13215
@@ -13267,11 +13266,9 @@ SDValue PPCTargetLowering::ConvertSETCCToSubtract(SDNode *N,
13267
13266
13268
13267
// If all users of SETCC extend its value to a legal integer type
13269
13268
// then we replace SETCC with a subtraction
13270
- for (SDNode::use_iterator UI = N->use_begin(),
13271
- UE = N->use_end(); UI != UE; ++UI) {
13272
- if (UI->getOpcode() != ISD::ZERO_EXTEND)
13269
+ for (const SDNode *U : N->uses())
13270
+ if (U->getOpcode() != ISD::ZERO_EXTEND)
13273
13271
return SDValue();
13274
- }
13275
13272
13276
13273
ISD::CondCode CC = cast<CondCodeSDNode>(N->getOperand(2))->get();
13277
13274
auto OpSize = N->getOperand(0).getValueSizeInBits();
@@ -13448,10 +13445,7 @@ SDValue PPCTargetLowering::DAGCombineTruncBoolExt(SDNode *N,
13448
13445
if (isa<ConstantSDNode>(Inputs[i]))
13449
13446
continue;
13450
13447
13451
- for (SDNode::use_iterator UI = Inputs[i].getNode()->use_begin(),
13452
- UE = Inputs[i].getNode()->use_end();
13453
- UI != UE; ++UI) {
13454
- SDNode *User = *UI;
13448
+ for (const SDNode *User : Inputs[i].getNode()->uses()) {
13455
13449
if (User != N && !Visited.count(User))
13456
13450
return SDValue();
13457
13451
@@ -13472,10 +13466,7 @@ SDValue PPCTargetLowering::DAGCombineTruncBoolExt(SDNode *N,
13472
13466
}
13473
13467
13474
13468
for (unsigned i = 0, ie = PromOps.size(); i != ie; ++i) {
13475
- for (SDNode::use_iterator UI = PromOps[i].getNode()->use_begin(),
13476
- UE = PromOps[i].getNode()->use_end();
13477
- UI != UE; ++UI) {
13478
- SDNode *User = *UI;
13469
+ for (const SDNode *User : PromOps[i].getNode()->uses()) {
13479
13470
if (User != N && !Visited.count(User))
13480
13471
return SDValue();
13481
13472
@@ -13660,10 +13651,7 @@ SDValue PPCTargetLowering::DAGCombineExtBoolTrunc(SDNode *N,
13660
13651
if (isa<ConstantSDNode>(Inputs[i]))
13661
13652
continue;
13662
13653
13663
- for (SDNode::use_iterator UI = Inputs[i].getNode()->use_begin(),
13664
- UE = Inputs[i].getNode()->use_end();
13665
- UI != UE; ++UI) {
13666
- SDNode *User = *UI;
13654
+ for (SDNode *User : Inputs[i].getNode()->uses()) {
13667
13655
if (User != N && !Visited.count(User))
13668
13656
return SDValue();
13669
13657
@@ -13685,10 +13673,7 @@ SDValue PPCTargetLowering::DAGCombineExtBoolTrunc(SDNode *N,
13685
13673
}
13686
13674
13687
13675
for (unsigned i = 0, ie = PromOps.size(); i != ie; ++i) {
13688
- for (SDNode::use_iterator UI = PromOps[i].getNode()->use_begin(),
13689
- UE = PromOps[i].getNode()->use_end();
13690
- UI != UE; ++UI) {
13691
- SDNode *User = *UI;
13676
+ for (SDNode *User : PromOps[i].getNode()->uses()) {
13692
13677
if (User != N && !Visited.count(User))
13693
13678
return SDValue();
13694
13679
@@ -15383,36 +15368,33 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N,
15383
15368
APInt::getAllOnes(Bits /* alignment */)
15384
15369
.zext(Add.getScalarValueSizeInBits()))) {
15385
15370
SDNode *BasePtr = Add->getOperand(0).getNode();
15386
- for (SDNode::use_iterator UI = BasePtr->use_begin(),
15387
- UE = BasePtr->use_end();
15388
- UI != UE; ++UI) {
15389
- if (UI->getOpcode() == ISD::INTRINSIC_WO_CHAIN &&
15390
- cast<ConstantSDNode>(UI->getOperand(0))->getZExtValue() ==
15391
- IID) {
15371
+ for (SDNode *U : BasePtr->uses()) {
15372
+ if (U->getOpcode() == ISD::INTRINSIC_WO_CHAIN &&
15373
+ cast<ConstantSDNode>(U->getOperand(0))->getZExtValue() == IID) {
15392
15374
// We've found another LVSL/LVSR, and this address is an aligned
15393
15375
// multiple of that one. The results will be the same, so use the
15394
15376
// one we've just found instead.
15395
15377
15396
- return SDValue(*UI , 0);
15378
+ return SDValue(U , 0);
15397
15379
}
15398
15380
}
15399
15381
}
15400
15382
15401
15383
if (isa<ConstantSDNode>(Add->getOperand(1))) {
15402
15384
SDNode *BasePtr = Add->getOperand(0).getNode();
15403
- for (SDNode::use_iterator UI = BasePtr->use_begin(),
15404
- UE = BasePtr->use_end(); UI != UE; ++UI) {
15405
- if (UI->getOpcode() == ISD::ADD &&
15406
- isa<ConstantSDNode>(UI->getOperand(1)) &&
15385
+ for (SDNode *U : BasePtr->uses()) {
15386
+ if (U->getOpcode() == ISD::ADD &&
15387
+ isa<ConstantSDNode>(U->getOperand(1)) &&
15407
15388
(cast<ConstantSDNode>(Add->getOperand(1))->getZExtValue() -
15408
- cast<ConstantSDNode>(UI->getOperand(1))->getZExtValue()) %
15409
- (1ULL << Bits) == 0) {
15410
- SDNode *OtherAdd = *UI;
15411
- for (SDNode::use_iterator VI = OtherAdd->use_begin(),
15412
- VE = OtherAdd->use_end(); VI != VE; ++VI) {
15413
- if (VI->getOpcode() == ISD::INTRINSIC_WO_CHAIN &&
15414
- cast<ConstantSDNode>(VI->getOperand(0))->getZExtValue() == IID) {
15415
- return SDValue(*VI, 0);
15389
+ cast<ConstantSDNode>(U->getOperand(1))->getZExtValue()) %
15390
+ (1ULL << Bits) ==
15391
+ 0) {
15392
+ SDNode *OtherAdd = U;
15393
+ for (SDNode *V : OtherAdd->uses()) {
15394
+ if (V->getOpcode() == ISD::INTRINSIC_WO_CHAIN &&
15395
+ cast<ConstantSDNode>(V->getOperand(0))->getZExtValue() ==
15396
+ IID) {
15397
+ return SDValue(V, 0);
15416
15398
}
15417
15399
}
15418
15400
}
0 commit comments