@@ -13229,12 +13229,11 @@ static bool ExtendUsesToFormExtLoad(EVT VT, SDNode *N, SDValue N0,
1322913229 const TargetLowering &TLI) {
1323013230 bool HasCopyToRegUses = false;
1323113231 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();
1323513234 if (User == N)
1323613235 continue;
13237- if (UI.getUse() .getResNo() != N0.getResNo())
13236+ if (Use .getResNo() != N0.getResNo())
1323813237 continue;
1323913238 // FIXME: Only extend SETCC N, N and SETCC N, c for now.
1324013239 if (ExtOpc != ISD::ANY_EXTEND && User->getOpcode() == ISD::SETCC) {
@@ -13266,9 +13265,7 @@ static bool ExtendUsesToFormExtLoad(EVT VT, SDNode *N, SDValue N0,
1326613265
1326713266 if (HasCopyToRegUses) {
1326813267 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()) {
1327213269 if (Use.getResNo() == 0 && Use.getUser()->getOpcode() == ISD::CopyToReg) {
1327313270 BothLiveOut = true;
1327413271 break;
@@ -13780,11 +13777,10 @@ SDValue DAGCombiner::foldSextSetcc(SDNode *N) {
1378013777
1378113778 // Non-chain users of this value must either be the setcc in this
1378213779 // 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()) {
1378513781 // 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())
1378813784 continue;
1378913785 // Extra users must have exactly the same cast we are about to create.
1379013786 // TODO: This restriction could be eased if ExtendUsesToFormExtLoad()
@@ -18928,7 +18924,7 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
1892818924 for (SDNode::use_iterator UI = BasePtr->use_begin(),
1892918925 UE = BasePtr->use_end();
1893018926 UI != UE; ++UI) {
18931- SDUse &Use = UI.getUse() ;
18927+ SDUse &Use = *UI ;
1893218928 // Skip the use that is Ptr and uses of other results from BasePtr's
1893318929 // node (important for nodes that return multiple results).
1893418930 if (Use.getUser() == Ptr.getNode() || Use != BasePtr)
@@ -20056,13 +20052,12 @@ bool DAGCombiner::SliceUpLoad(SDNode *N) {
2005620052 // Check if this load is used as several smaller chunks of bits.
2005720053 // Basically, look for uses in trunc or trunc(lshr) and record a new chain
2005820054 // 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()) {
2006120056 // Skip the uses of the chain.
20062- if (UI.getUse() .getResNo() != 0)
20057+ if (U .getResNo() != 0)
2006320058 continue;
2006420059
20065- SDNode *User = *UI ;
20060+ SDNode *User = U.getUser() ;
2006620061 unsigned Shift = 0;
2006720062
2006820063 // Check if this is a trunc(lshr).
@@ -20940,7 +20935,7 @@ DAGCombiner::getStoreMergeCandidates(StoreSDNode *St,
2094020935 // This must be a chain use.
2094120936 if (UseIter.getOperandNo() != 0)
2094220937 return;
20943- if (auto *OtherStore = dyn_cast<StoreSDNode>(* UseIter)) {
20938+ if (auto *OtherStore = dyn_cast<StoreSDNode>(UseIter->getUser() )) {
2094420939 BaseIndexOffset Ptr;
2094520940 int64_t PtrDiff;
2094620941 if (CandidateMatch(OtherStore, Ptr, PtrDiff) &&
@@ -20958,12 +20953,13 @@ DAGCombiner::getStoreMergeCandidates(StoreSDNode *St,
2095820953 return nullptr;
2095920954 for (auto I = RootNode->use_begin(), E = RootNode->use_end();
2096020955 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)
2096320959 TryToAddCandidate(I2);
2096420960 }
2096520961 // 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 )) {
2096720963 TryToAddCandidate(I);
2096820964 }
2096920965 }
@@ -27320,8 +27316,7 @@ SDValue DAGCombiner::visitGET_FPENV_MEM(SDNode *N) {
2732027316
2732127317 // Check if the loaded value is used only in a store operation.
2732227318 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()) {
2732527320 if (U.getResNo() == 0) {
2732627321 if (auto *St = dyn_cast<StoreSDNode>(U.getUser())) {
2732727322 if (StNode)
0 commit comments