@@ -13229,12 +13229,11 @@ static bool ExtendUsesToFormExtLoad(EVT VT, SDNode *N, SDValue N0,
13229
13229
const TargetLowering &TLI) {
13230
13230
bool HasCopyToRegUses = false;
13231
13231
bool isTruncFree = TLI.isTruncateFree(VT, N0.getValueType());
13232
- for (SDNode::use_iterator UI = N0->use_begin(), UE = N0->use_end(); UI != UE;
13233
- ++UI) {
13234
- SDNode *User = *UI;
13232
+ for (SDUse &Use : N0->uses()) {
13233
+ SDNode *User = Use.getUser();
13235
13234
if (User == N)
13236
13235
continue;
13237
- if (UI.getUse() .getResNo() != N0.getResNo())
13236
+ if (Use .getResNo() != N0.getResNo())
13238
13237
continue;
13239
13238
// FIXME: Only extend SETCC N, N and SETCC N, c for now.
13240
13239
if (ExtOpc != ISD::ANY_EXTEND && User->getOpcode() == ISD::SETCC) {
@@ -13266,9 +13265,7 @@ static bool ExtendUsesToFormExtLoad(EVT VT, SDNode *N, SDValue N0,
13266
13265
13267
13266
if (HasCopyToRegUses) {
13268
13267
bool BothLiveOut = false;
13269
- for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
13270
- UI != UE; ++UI) {
13271
- SDUse &Use = UI.getUse();
13268
+ for (SDUse &Use : N->uses()) {
13272
13269
if (Use.getResNo() == 0 && Use.getUser()->getOpcode() == ISD::CopyToReg) {
13273
13270
BothLiveOut = true;
13274
13271
break;
@@ -13780,11 +13777,10 @@ SDValue DAGCombiner::foldSextSetcc(SDNode *N) {
13780
13777
13781
13778
// Non-chain users of this value must either be the setcc in this
13782
13779
// sequence or extends that can be folded into the new {z/s}ext-load.
13783
- for (SDNode::use_iterator UI = V->use_begin(), UE = V->use_end();
13784
- UI != UE; ++UI) {
13780
+ for (SDUse &Use : V->uses()) {
13785
13781
// Skip uses of the chain and the setcc.
13786
- SDNode *User = *UI ;
13787
- if (UI.getUse() .getResNo() != 0 || User == N0.getNode())
13782
+ SDNode *User = Use.getUser() ;
13783
+ if (Use .getResNo() != 0 || User == N0.getNode())
13788
13784
continue;
13789
13785
// Extra users must have exactly the same cast we are about to create.
13790
13786
// TODO: This restriction could be eased if ExtendUsesToFormExtLoad()
@@ -18928,7 +18924,7 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
18928
18924
for (SDNode::use_iterator UI = BasePtr->use_begin(),
18929
18925
UE = BasePtr->use_end();
18930
18926
UI != UE; ++UI) {
18931
- SDUse &Use = UI.getUse() ;
18927
+ SDUse &Use = *UI ;
18932
18928
// Skip the use that is Ptr and uses of other results from BasePtr's
18933
18929
// node (important for nodes that return multiple results).
18934
18930
if (Use.getUser() == Ptr.getNode() || Use != BasePtr)
@@ -20056,13 +20052,12 @@ bool DAGCombiner::SliceUpLoad(SDNode *N) {
20056
20052
// Check if this load is used as several smaller chunks of bits.
20057
20053
// Basically, look for uses in trunc or trunc(lshr) and record a new chain
20058
20054
// of computation for each trunc.
20059
- for (SDNode::use_iterator UI = LD->use_begin(), UIEnd = LD->use_end();
20060
- UI != UIEnd; ++UI) {
20055
+ for (SDUse &U : LD->uses()) {
20061
20056
// Skip the uses of the chain.
20062
- if (UI.getUse() .getResNo() != 0)
20057
+ if (U .getResNo() != 0)
20063
20058
continue;
20064
20059
20065
- SDNode *User = *UI ;
20060
+ SDNode *User = U.getUser() ;
20066
20061
unsigned Shift = 0;
20067
20062
20068
20063
// Check if this is a trunc(lshr).
@@ -20940,7 +20935,7 @@ DAGCombiner::getStoreMergeCandidates(StoreSDNode *St,
20940
20935
// This must be a chain use.
20941
20936
if (UseIter.getOperandNo() != 0)
20942
20937
return;
20943
- if (auto *OtherStore = dyn_cast<StoreSDNode>(* UseIter)) {
20938
+ if (auto *OtherStore = dyn_cast<StoreSDNode>(UseIter->getUser() )) {
20944
20939
BaseIndexOffset Ptr;
20945
20940
int64_t PtrDiff;
20946
20941
if (CandidateMatch(OtherStore, Ptr, PtrDiff) &&
@@ -20958,12 +20953,13 @@ DAGCombiner::getStoreMergeCandidates(StoreSDNode *St,
20958
20953
return nullptr;
20959
20954
for (auto I = RootNode->use_begin(), E = RootNode->use_end();
20960
20955
I != E && NumNodesExplored < MaxSearchNodes; ++I, ++NumNodesExplored) {
20961
- if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) { // walk down chain
20962
- for (auto I2 = (*I)->use_begin(), E2 = (*I)->use_end(); I2 != E2; ++I2)
20956
+ SDNode *User = I->getUser();
20957
+ if (I.getOperandNo() == 0 && isa<LoadSDNode>(User)) { // walk down chain
20958
+ for (auto I2 = User->use_begin(), E2 = User->use_end(); I2 != E2; ++I2)
20963
20959
TryToAddCandidate(I2);
20964
20960
}
20965
20961
// Check stores that depend on the root (e.g. Store 3 in the chart above).
20966
- if (I.getOperandNo() == 0 && isa<StoreSDNode>(*I )) {
20962
+ if (I.getOperandNo() == 0 && isa<StoreSDNode>(User )) {
20967
20963
TryToAddCandidate(I);
20968
20964
}
20969
20965
}
@@ -27320,8 +27316,7 @@ SDValue DAGCombiner::visitGET_FPENV_MEM(SDNode *N) {
27320
27316
27321
27317
// Check if the loaded value is used only in a store operation.
27322
27318
StoreSDNode *StNode = nullptr;
27323
- for (auto I = LdNode->use_begin(), E = LdNode->use_end(); I != E; ++I) {
27324
- SDUse &U = I.getUse();
27319
+ for (SDUse &U : LdNode->uses()) {
27325
27320
if (U.getResNo() == 0) {
27326
27321
if (auto *St = dyn_cast<StoreSDNode>(U.getUser())) {
27327
27322
if (StNode)
0 commit comments