From ace8b7dc5a86f30f5484095270216f74db5d4231 Mon Sep 17 00:00:00 2001 From: binaryfz Date: Sat, 15 Feb 2020 09:37:49 +0800 Subject: [PATCH] code refactor --- src/maple_me/src/me_hdse.cpp | 2 +- src/maple_me/src/me_loop_analysis.cpp | 4 +-- src/maple_me/src/me_loop_canon.cpp | 2 +- src/maple_me/src/me_lower_globals.cpp | 4 +-- src/maple_me/src/me_rename2preg.cpp | 2 +- src/maple_me/src/me_ssa_lpre.cpp | 14 ++++----- src/maple_me/src/me_ssu_pre.cpp | 8 ++--- src/maple_me/src/me_stmt_pre.cpp | 8 ++--- src/maple_me/src/me_store_pre.cpp | 2 +- src/maple_me/src/occur.cpp | 2 +- src/maple_me/src/ssa.cpp | 6 ++-- src/maple_me/src/ssa_epre.cpp | 18 +++++------ src/maple_me/src/ssa_pre.cpp | 44 +++++++++++++-------------- 13 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/maple_me/src/me_hdse.cpp b/src/maple_me/src/me_hdse.cpp index 528eb5a229..48bcdcb529 100644 --- a/src/maple_me/src/me_hdse.cpp +++ b/src/maple_me/src/me_hdse.cpp @@ -101,7 +101,7 @@ void MeDoHDSE::MakeEmptyTrysUnreachable(MeFunction &func) { } // tryBB has no phis, no need to update them for (auto bb : toDeleteTryPreds) { - bb->RemoveBBFromVector(tryBB->GetPred()); + (void)bb->RemoveBBFromVector(tryBB->GetPred()); } } } diff --git a/src/maple_me/src/me_loop_analysis.cpp b/src/maple_me/src/me_loop_analysis.cpp index 5cbc740814..32e6a25902 100644 --- a/src/maple_me/src/me_loop_analysis.cpp +++ b/src/maple_me/src/me_loop_analysis.cpp @@ -67,7 +67,7 @@ void IdentifyLoops::ProcessBB(BB *bb) { } // recursive call const MapleSet &domChildren = dominance->GetDomChildren(bb->GetBBId()); - for (auto bbIt = domChildren.begin(); bbIt != domChildren.end(); bbIt++) { + for (auto bbIt = domChildren.begin(); bbIt != domChildren.end(); ++bbIt) { ProcessBB(func->GetAllBBs().at(*bbIt)); } } @@ -78,7 +78,7 @@ void IdentifyLoops::Dump() { LogInfo::MapleLogger() << "nest depth: " << mploop->nestDepth << " loop head BB: " << mploop->head->GetBBId() << " tail BB:" << mploop->tail->GetBBId() << '\n'; LogInfo::MapleLogger() << "loop body:"; - for (auto it = mploop->loopBBs.begin(); it != mploop->loopBBs.end(); it++) { + for (auto it = mploop->loopBBs.begin(); it != mploop->loopBBs.end(); ++it) { BBId bbId = *it; LogInfo::MapleLogger() << bbId << " "; } diff --git a/src/maple_me/src/me_loop_canon.cpp b/src/maple_me/src/me_loop_canon.cpp index 9161bcc1c8..c80db1fda4 100644 --- a/src/maple_me/src/me_loop_canon.cpp +++ b/src/maple_me/src/me_loop_canon.cpp @@ -254,7 +254,7 @@ AnalysisResult *MeDoLoopCanon::Run(MeFunction *func, MeFuncResultMgr *m, ModuleR LogInfo::MapleLogger() << "-----------------Dump mefunction before loop convert----------\n"; func->Dump(true); } - for (auto it = backEdges.begin(); it != backEdges.end(); it++) { + for (auto it = backEdges.begin(); it != backEdges.end(); ++it) { Convert(func, (*it).first, (*it).second, swapSuccs); if (DEBUGFUNC(func)) { LogInfo::MapleLogger() << "-----------------Dump mefunction after loop convert-----------\n"; diff --git a/src/maple_me/src/me_lower_globals.cpp b/src/maple_me/src/me_lower_globals.cpp index 469edf548f..e873350b02 100644 --- a/src/maple_me/src/me_lower_globals.cpp +++ b/src/maple_me/src/me_lower_globals.cpp @@ -68,7 +68,7 @@ void MeLowerGlobals::LowerGlobalDreads(MeStmt &stmt, MeExpr *x) { MIRPtrType ptrType(baseOst->GetTyIdx(), PTY_ptr); TyIdx addrTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); auto *ivarExpr = static_cast(irMap->CreateIvarMeExpr(*varExpr, addrTyIdx, *addrofExpr)); - irMap->ReplaceMeExprStmt(stmt, *varExpr, *ivarExpr); + (void)irMap->ReplaceMeExprStmt(stmt, *varExpr, *ivarExpr); break; } case kMeOpAddrof: { @@ -88,7 +88,7 @@ void MeLowerGlobals::LowerGlobalDreads(MeStmt &stmt, MeExpr *x) { MIRPtrType ptrType(baseOst->GetTyIdx(), PTY_ptr); TyIdx addrTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MeExpr *iaddrofExpr = irMap->CreateIaddrofMeExpr(*addrofExpr, addrTyIdx, *newAddrofExpr); - irMap->ReplaceMeExprStmt(stmt, *addrofExpr, *iaddrofExpr); + (void)irMap->ReplaceMeExprStmt(stmt, *addrofExpr, *iaddrofExpr); break; } default: diff --git a/src/maple_me/src/me_rename2preg.cpp b/src/maple_me/src/me_rename2preg.cpp index b727d4c3dd..5511ba97a9 100644 --- a/src/maple_me/src/me_rename2preg.cpp +++ b/src/maple_me/src/me_rename2preg.cpp @@ -292,7 +292,7 @@ class SSARename2Preg { void Rename2PregLeafRHS(const AliasClass &aliasClass, MeIRMap &irMap, MeStmt &stmt, VarMeExpr &varExpr) { RegMeExpr *regExpr = RenameVar(aliasClass, varExpr); if (regExpr != nullptr) { - irMap.ReplaceMeExprStmt(stmt, varExpr, *regExpr); + (void)irMap.ReplaceMeExprStmt(stmt, varExpr, *regExpr); } } diff --git a/src/maple_me/src/me_ssa_lpre.cpp b/src/maple_me/src/me_ssa_lpre.cpp index fd23187e23..7eb2b17956 100644 --- a/src/maple_me/src/me_ssa_lpre.cpp +++ b/src/maple_me/src/me_ssa_lpre.cpp @@ -27,7 +27,7 @@ void MeSSALPre::GenerateSaveRealOcc(MeRealOcc *realOcc) { regOrVar->SetDefByStmt(*newMeStmt); realOcc->GetMeStmt()->GetBB()->InsertMeStmtBefore(realOcc->GetMeStmt(), newMeStmt); // replace realOcc->GetMeStmt()'s occ with regOrVar - irMap->ReplaceMeExprStmt(*realOcc->GetMeStmt(), *realOcc->GetMeExpr(), *regOrVar); + (void)irMap->ReplaceMeExprStmt(*realOcc->GetMeStmt(), *realOcc->GetMeExpr(), *regOrVar); } else if (realOcc->IsFormalAtEntry()) { // no need generate any code, but change formal declaration to preg CHECK_FATAL(regOrVar->GetMeOp() == kMeOpReg, "formals not promoted to register"); @@ -114,7 +114,7 @@ void MeSSALPre::GenerateReloadRealOcc(MeRealOcc *realOcc) { } CHECK_NULL_FATAL(regOrVar); // replace realOcc->GetMeStmt()'s occ with regOrVar - irMap->ReplaceMeExprStmt(*realOcc->GetMeStmt(), *realOcc->GetMeExpr(), *regOrVar); + (void)irMap->ReplaceMeExprStmt(*realOcc->GetMeStmt(), *realOcc->GetMeExpr(), *regOrVar); } // the variable in realZ is defined by a phi; replace it by the jth phi opnd @@ -207,7 +207,7 @@ void MeSSALPre::BuildWorkListLHSOcc(MeStmt *meStmt, int32 seqStmt) { if (lhs->GetPrimType() == PTY_agg) { return; } - CreateRealOcc(*meStmt, seqStmt, *lhs, false, true); + (void)CreateRealOcc(*meStmt, seqStmt, *lhs, false, true); } else if (kOpcodeInfo.IsCallAssigned(meStmt->GetOp())) { MapleVector *mustDefList = meStmt->GetMustDefList(); if (mustDefList->empty()) { @@ -230,7 +230,7 @@ void MeSSALPre::BuildWorkListLHSOcc(MeStmt *meStmt, int32 seqStmt) { if (theLHS->GetPrimType() == PTY_agg) { return; } - CreateRealOcc(*meStmt, seqStmt, *theLHS, false, true); + (void)CreateRealOcc(*meStmt, seqStmt, *theLHS, false, true); } } @@ -275,7 +275,7 @@ void MeSSALPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, if (meExpr->GetPrimType() == PTY_agg) { break; } - CreateRealOcc(*meStmt, seqStmt, *meExpr, false); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, false); break; } case kMeOpAddrof: { @@ -287,14 +287,14 @@ void MeSSALPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, if (ost->IsLocal()) { // skip lpre for stack addresses as they are cheap break; } - CreateRealOcc(*meStmt, seqStmt, *meExpr, false); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, false); break; } case kMeOpAddroffunc: { if (preKind != kAddrPre) { break; } - CreateRealOcc(*meStmt, seqStmt, *meExpr, false); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, false); break; } case kMeOpOp: { diff --git a/src/maple_me/src/me_ssu_pre.cpp b/src/maple_me/src/me_ssu_pre.cpp index 17f12ed235..1f60375d07 100644 --- a/src/maple_me/src/me_ssu_pre.cpp +++ b/src/maple_me/src/me_ssu_pre.cpp @@ -461,7 +461,7 @@ void MeSSUPre::CreateSortedOccs() { case kSOccPhi: // get the next real/use occ CHECK_FATAL(realOccIt != workCand->GetRealOccs().end(), "iterator check"); - realOccIt++; + ++realOccIt; if (realOccIt != workCand->GetRealOccs().end()) { nextRealOcc = *realOccIt; } else { @@ -470,7 +470,7 @@ void MeSSUPre::CreateSortedOccs() { break; case kSOccEntry: CHECK_FATAL(entryOccIt != entryOccs.end(), "iterator check"); - entryOccIt++; + ++entryOccIt; if (entryOccIt != entryOccs.end()) { nextEntryOcc = *entryOccIt; } else { @@ -480,7 +480,7 @@ void MeSSUPre::CreateSortedOccs() { case kSOccLambda: lambdaOccs.push_back(static_cast(pickedOcc)); CHECK_FATAL(lambdaDfnIt != lambdaDfns.end(), "iterator check"); - lambdaDfnIt++; + ++lambdaDfnIt; if (lambdaDfnIt != lambdaDfns.end()) { nextLambdaOcc = spreMp->New(func->GetAllBBs().at(dom->GetPdtPreOrderItem(*lambdaDfnIt)), &spreAllocator); @@ -490,7 +490,7 @@ void MeSSUPre::CreateSortedOccs() { break; case kSOccLambdaRes: CHECK_FATAL(lambdaResDfnIt != lambdaResDfns.end(), "iterator check"); - lambdaResDfnIt++; + ++lambdaResDfnIt; if (lambdaResDfnIt != lambdaResDfns.end()) { nextLambdaResOcc = spreMp->New(func->GetAllBBs().at(dom->GetPdtPreOrderItem(*lambdaResDfnIt))); diff --git a/src/maple_me/src/me_stmt_pre.cpp b/src/maple_me/src/me_stmt_pre.cpp index 274ad5b311..0b86840670 100644 --- a/src/maple_me/src/me_stmt_pre.cpp +++ b/src/maple_me/src/me_stmt_pre.cpp @@ -907,7 +907,7 @@ void MeStmtPre::BuildWorkListBB(BB *bb) { if (!unaryStmt.GetOpnd()->IsLeaf()) { break; } - CreateStmtRealOcc(stmt, seqStmt); + (void)CreateStmtRealOcc(stmt, seqStmt); break; } case OP_dassign: { @@ -929,7 +929,7 @@ void MeStmtPre::BuildWorkListBB(BB *bb) { stmtWkCand->SetLHSIsFinal(true); } else if (!dassMeStmt.GetRHS()->SymAppears(varMeExpr->GetOStIdx()) && dassMeStmt.GetRHS()->Pure()) { if (NoPriorUseInBB(dassMeStmt.GetVarLHS(), &stmt)) { - CreateStmtRealOcc(stmt, seqStmt); + (void)CreateStmtRealOcc(stmt, seqStmt); } } else if (dassMeStmt.GetLHS()->IsUseSameSymbol(*dassMeStmt.GetRHS())) { RemoveUnnecessaryDassign(&dassMeStmt); @@ -948,7 +948,7 @@ void MeStmtPre::BuildWorkListBB(BB *bb) { break; } if (intrnStmt.GetIntrinsic() == INTRN_JAVA_CLINIT_CHECK) { - CreateStmtRealOcc(stmt, seqStmt); + (void)CreateStmtRealOcc(stmt, seqStmt); } break; } @@ -965,7 +965,7 @@ void MeStmtPre::BuildWorkListBB(BB *bb) { break; } if (intrnStmt.GetIntrinsic() == INTRN_MPL_BOUNDARY_CHECK) { - CreateStmtRealOcc(stmt, seqStmt); + (void)CreateStmtRealOcc(stmt, seqStmt); } VersionStackChiListUpdate(*intrnStmt.GetChiList()); break; diff --git a/src/maple_me/src/me_store_pre.cpp b/src/maple_me/src/me_store_pre.cpp index 21a83d74f8..4b270153b6 100644 --- a/src/maple_me/src/me_store_pre.cpp +++ b/src/maple_me/src/me_store_pre.cpp @@ -252,7 +252,7 @@ void MeStorePre::CreateSpreUseOccsThruAliasing(const OriginalSt *muOst, BB *bb) if (ae->GetClassSet() == nullptr) { return; } - for (auto setIt = ae->GetClassSet()->begin(); setIt != ae->GetClassSet()->end(); setIt++) { + for (auto setIt = ae->GetClassSet()->begin(); setIt != ae->GetClassSet()->end(); ++setIt) { unsigned int elemId = *setIt; AliasElem *ae0 = aliasClass->FindID2Elem(elemId); if (ae0->GetOriginalSt().GetIndirectLev() == 0) { diff --git a/src/maple_me/src/occur.cpp b/src/maple_me/src/occur.cpp index 7aebc1ef1a..d5293600a8 100644 --- a/src/maple_me/src/occur.cpp +++ b/src/maple_me/src/occur.cpp @@ -275,7 +275,7 @@ void PreWorkCand::AddRealOccSorted(Dominance &dom, MeRealOcc &occ, PUIdx pIdx) { AddRealOccAsLast(occ, pIdx); } else { auto rIt = realOccs.rbegin(); - rIt++; + ++rIt; while (rIt != realOccs.rend()) { if (occDfn > dom.GetDtDfnItem((*rIt)->GetBB()->GetBBId())) { break; diff --git a/src/maple_me/src/ssa.cpp b/src/maple_me/src/ssa.cpp index b29b0c710b..ee56c57e5e 100644 --- a/src/maple_me/src/ssa.cpp +++ b/src/maple_me/src/ssa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved. + * Copyright (c) [2019-2020] Huawei Technologies Co.,Ltd.All rights reserved. * * OpenArkCompiler is licensed under the Mulan PSL v1. * You can use this software according to the terms and conditions of the Mulan PSL v1. @@ -73,7 +73,7 @@ void SSA::RenameDefs(StmtNode &stmt, BB &defBB) { } if (kOpcodeInfo.HasSSADef(opcode)) { MapleMap &mayDefList = theSSAPart->GetMayDefNodes(); - for (auto it = mayDefList.begin(); it != mayDefList.end(); it++) { + for (auto it = mayDefList.begin(); it != mayDefList.end(); ++it) { MayDefNode &mayDef = it->second; VersionSt *vSym = mayDef.GetResult(); CHECK_FATAL(vSym->GetOrigIdx() < vstStacks.size(), "index out of range in SSA::RenameMayDefs"); @@ -102,7 +102,7 @@ void SSA::RenameMustDefs(const StmtNode &stmt, BB &defBB) { void SSA::RenameMayUses(BaseNode &node) { MapleMap &mayUseList = ssaTab->GetStmtsSSAPart().GetMayUseNodesOf(static_cast(node)); MapleMap::iterator it = mayUseList.begin(); - for (; it != mayUseList.end(); it++) { + for (; it != mayUseList.end(); ++it) { MayUseNode &mayUse = it->second; VersionSt *vSym = mayUse.GetOpnd(); CHECK_FATAL(vSym->GetOrigIdx() < vstStacks.size(), "index out of range in SSA::RenameMayUses"); diff --git a/src/maple_me/src/ssa_epre.cpp b/src/maple_me/src/ssa_epre.cpp index eefdd2c94a..81c68b9715 100644 --- a/src/maple_me/src/ssa_epre.cpp +++ b/src/maple_me/src/ssa_epre.cpp @@ -68,7 +68,7 @@ void SSAEPre::GenerateSaveLHSRealocc(MeRealOcc *realOcc, MeExpr *regOrVar) { newIass->SetBB(savedBB); savedBB->InsertMeStmtAfter(rass, newIass); // go throu saved_Chi_List to update each chi base to point to newIass - for (auto it = newIass->GetChiList()->begin(); it != newIass->GetChiList()->end(); it++) { + for (auto it = newIass->GetChiList()->begin(); it != newIass->GetChiList()->end(); ++it) { ChiMeNode *chi = it->second; chi->SetBase(newIass); } @@ -210,7 +210,7 @@ void SSAEPre::ComputeVarAndDfPhis() { dfPhiDfns.clear(); const MapleVector &realOccList = workCand->GetRealOccs(); CHECK_FATAL(!dom->IsBBVecEmpty(), "size to be allocated is 0"); - for (auto it = realOccList.begin(); it != realOccList.end(); it++) { + for (auto it = realOccList.begin(); it != realOccList.end(); ++it) { MeRealOcc *realOcc = *it; BB *defBB = realOcc->GetBB(); std::vector visitedMap(dom->GetBBVecSize(), false); @@ -285,7 +285,7 @@ void SSAEPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, b (epreIncludeRef || meOpExpr->GetPrimType() != PTY_ref)) { // create a HypotheTemp for this expr // Exclude cmp operator - CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); } break; } @@ -294,7 +294,7 @@ void SSAEPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, b bool isHypo = true; bool hasTempVarAs1Opnd = false; MapleVector &opnds = naryMeExpr->GetOpnds(); - for (auto it = opnds.begin(); it != opnds.end(); it++) { + for (auto it = opnds.begin(); it != opnds.end(); ++it) { MeExpr *opnd = *it; if (!opnd->IsLeaf()) { BuildWorkListExpr(meStmt, seqStmt, opnd, isRebuild, tempVar, false); @@ -318,11 +318,11 @@ void SSAEPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, b auto *ptrMIRType = static_cast(mirType); MIRJarrayType *arryType = safe_cast(ptrMIRType->GetPointedType()); if (arryType == nullptr) { - CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); } else { int dim = arryType->GetDim(); // to compute the dim field if (dim < 2) { - CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); } else { if (GetSSAPreDebug()) { mirModule->GetOut() << "----- real occ suppressed for jarray with dim " << dim << '\n'; @@ -341,7 +341,7 @@ void SSAEPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, b } } if (!intrinDesc->IsLoadMem()) { - CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); } } } @@ -360,7 +360,7 @@ void SSAEPre::BuildWorkListExpr(MeStmt *meStmt, int32 seqStmt, MeExpr *meExpr, b } else if (!epreIncludeRef && ivarMeExpr->GetPrimType() == PTY_ref) { break; } else if (!isRebuild || base->IsUseSameSymbol(*tempVar)) { - CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); + (void)CreateRealOcc(*meStmt, seqStmt, *meExpr, isRebuild); } break; } @@ -412,7 +412,7 @@ void SSAEPre::BuildWorkListIvarLHSOcc(MeStmt *meStmt, int32 seqStmt, bool isRebu return; } if (!isRebuild || base->IsUseSameSymbol(*tempVar)) { - CreateRealOcc(*meStmt, seqStmt, *ivarMeExpr, isRebuild, true); + (void)CreateRealOcc(*meStmt, seqStmt, *ivarMeExpr, isRebuild, true); } } diff --git a/src/maple_me/src/ssa_pre.cpp b/src/maple_me/src/ssa_pre.cpp index 5d033b4201..753faddde6 100644 --- a/src/maple_me/src/ssa_pre.cpp +++ b/src/maple_me/src/ssa_pre.cpp @@ -169,7 +169,7 @@ void SSAPre::GenerateSavePhiOcc(MePhiOcc *phiOcc) { } void SSAPre::UpdateInsertedPhiOccOpnd() { - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (phiOcc->IsWillBeAvail() && !phiOcc->IsExtraneous()) { if (phiOcc->GetRegPhi()) { @@ -415,7 +415,7 @@ void SSAPre::SetSave(MeOccur *defX) { void SSAPre::SetReplacement(MePhiOcc *occg, MeOccur *repDef) { occg->SetIsRemoved(true); // exclude recursive PhiOcc - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (phiOcc->IsRemoved()) { continue; @@ -433,7 +433,7 @@ void SSAPre::SetReplacement(MePhiOcc *occg, MeOccur *repDef) { } } } - for (auto it = workCand->GetRealOccs().begin(); it != workCand->GetRealOccs().end(); it++) { + for (auto it = workCand->GetRealOccs().begin(); it != workCand->GetRealOccs().end(); ++it) { MeRealOcc *realOcc = *it; // when realOcc satisfying reload and def of it is occg, do the replacement if (realOcc->IsReload() && realOcc->GetDef() == occg) { @@ -444,7 +444,7 @@ void SSAPre::SetReplacement(MePhiOcc *occg, MeOccur *repDef) { } void SSAPre::Finalize2() { - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; // initialize extraneouse for each MePhiOcc phiOcc->SetIsExtraneous(phiOcc->IsWillBeAvail()); @@ -453,13 +453,13 @@ void SSAPre::Finalize2() { phiOpnd->SetIsProcessed(false); } } - for (auto it = workCand->GetRealOccs().begin(); it != workCand->GetRealOccs().end(); it++) { + for (auto it = workCand->GetRealOccs().begin(); it != workCand->GetRealOccs().end(); ++it) { MeRealOcc *realOcc = *it; if (realOcc->IsReload()) { SetSave(realOcc->GetDef()); } } - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (phiOcc->IsRemoved() || !phiOcc->IsExtraneous()) { continue; @@ -521,7 +521,7 @@ void SSAPre::Finalize2() { void SSAPre::ResetCanBeAvail(MePhiOcc *occg) { occg->SetIsCanBeAvail(false); // the following loop is to find occg's use list and reset them - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; for (MePhiOpndOcc *phiOpnd : phiOcc->GetPhiOpnds()) { if (phiOpnd->GetDef() && phiOpnd->GetDef() == occg) { @@ -535,7 +535,7 @@ void SSAPre::ResetCanBeAvail(MePhiOcc *occg) { } void SSAPre::ComputeCanBeAvail() { - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (!phiOcc->IsDownSafe() && phiOcc->IsCanBeAvail()) { bool existNullDef = false; @@ -567,7 +567,7 @@ void SSAPre::ComputeCanBeAvail() { void SSAPre::ResetLater(MePhiOcc *occg) { occg->SetIsLater(false); // the following loop is to find occg's use list and reset them - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; for (MePhiOpndOcc *phiOpnd : phiOcc->GetPhiOpnds()) { if (phiOpnd->GetDef() && phiOpnd->GetDef() == occg) { @@ -581,11 +581,11 @@ void SSAPre::ResetLater(MePhiOcc *occg) { } void SSAPre::ComputeLater() { - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; phiOcc->SetIsLater(phiOcc->IsCanBeAvail()); } - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (phiOcc->IsLater()) { bool existNonNullDef = false; @@ -603,7 +603,7 @@ void SSAPre::ComputeLater() { if (GetSSAPreDebug()) { mirModule->GetOut() << "========ssapre candidate " << workCand->GetIndex() << " after WillBeAvail===================\n"; - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; phiOcc->Dump(*irMap); if (phiOcc->IsCanBeAvail()) { @@ -651,7 +651,7 @@ void SSAPre::ResetDS(MePhiOpndOcc *phiOpnd) { // compute downsafety for each PHI void SSAPre::ComputeDS() { - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; if (!phiOcc->IsDownSafe()) { // propagate not-downsafety along use-def edges @@ -663,7 +663,7 @@ void SSAPre::ComputeDS() { if (GetSSAPreDebug()) { mirModule->GetOut() << "========ssapre candidate " << workCand->GetIndex() << " after DownSafety===================\n"; - for (auto it = phiOccs.begin(); it != phiOccs.end(); it++) { + for (auto it = phiOccs.begin(); it != phiOccs.end(); ++it) { MePhiOcc *phiOcc = *it; phiOcc->Dump(*irMap); if (phiOcc->SpeculativeDownSafe()) { @@ -968,7 +968,7 @@ void SSAPre::SetVarPhis(MeExpr *meExpr) { BBId defbbid = phiMeNode->GetDefBB()->GetBBId(); if (varPhiDfns.find(dom->GetDtDfnItem(defbbid)) == varPhiDfns.end() && ScreenPhiBB(defbbid)) { varPhiDfns.insert(dom->GetDtDfnItem(defbbid)); - for (auto opndit = phiMeNode->GetOpnds().begin(); opndit != phiMeNode->GetOpnds().end(); opndit++) { + for (auto opndit = phiMeNode->GetOpnds().begin(); opndit != phiMeNode->GetOpnds().end(); ++opndit) { VarMeExpr *opnd = *opndit; SetVarPhis(opnd); } @@ -1069,7 +1069,7 @@ void SSAPre::CreateSortedOccs() { switch (pickedOcc->GetOccType()) { case kOccReal: case kOccMembar: - realOccIt++; + ++realOccIt; if (realOccIt != workCand->GetRealOccs().end()) { nextRealOcc = *realOccIt; } else { @@ -1077,7 +1077,7 @@ void SSAPre::CreateSortedOccs() { } break; case kOccExit: - exitOccIt++; + ++exitOccIt; if (exitOccIt != exitOccs.end()) { nextExitOcc = *exitOccIt; } else { @@ -1086,7 +1086,7 @@ void SSAPre::CreateSortedOccs() { break; case kOccPhiocc: phiOccs.push_back(static_cast(pickedOcc)); - phiDfnIt++; + ++phiDfnIt; if (phiDfnIt != dfPhiDfns.end()) { CHECK_FATAL(GetBB(dom->GetDtPreOrderItem(*phiDfnIt)) != nullptr, "GetBB return null in SSAPre::CreateSortedOccs"); @@ -1096,7 +1096,7 @@ void SSAPre::CreateSortedOccs() { } break; case kOccPhiopnd: - phiOpndDfnIt++; + ++phiOpndDfnIt; if (phiOpndDfnIt != phiOpndDfns.end()) { nextPhiOpndOcc = perCandMemPool->New(GetBB(dom->GetDtPreOrderItem(*phiOpndDfnIt))); auto it = bb2phiopndMap.find(dom->GetDtPreOrderItem(*phiOpndDfnIt)); @@ -1481,7 +1481,7 @@ void SSAPre::BuildWorkListStmt(MeStmt *meStmt, uint32 seqStmt, bool isRebuilt, M case OP_syncexit: { auto *syncMeStmt = static_cast(meStmt); MapleVector &opnds = syncMeStmt->GetOpnds(); - for (auto it = opnds.begin(); it != opnds.end(); it++) { + for (auto it = opnds.begin(); it != opnds.end(); ++it) { BuildWorkListExpr(meStmt, seqStmt, *it, isRebuilt, tempVar, true); } break; @@ -1529,7 +1529,7 @@ void SSAPre::BuildWorkListStmt(MeStmt *meStmt, uint32 seqStmt, bool isRebuilt, M case OP_icallassigned: { auto *naryMeStmt = static_cast(meStmt); MapleVector &opnds = naryMeStmt->GetOpnds(); - for (auto it = opnds.begin(); it != opnds.end(); it++) { + for (auto it = opnds.begin(); it != opnds.end(); ++it) { BuildWorkListExpr(meStmt, seqStmt, *it, isRebuilt, tempVar, true); } break; @@ -1551,7 +1551,7 @@ void SSAPre::BuildWorkListStmt(MeStmt *meStmt, uint32 seqStmt, bool isRebuilt, M case OP_intrinsiccallwithtypeassigned: { auto *naryMeStmt = static_cast(meStmt); MapleVector &opnds = naryMeStmt->GetOpnds(); - for (auto it = opnds.begin(); it != opnds.end(); it++) { + for (auto it = opnds.begin(); it != opnds.end(); ++it) { if (!GetRcLoweringOn() && (*it)->IsLeaf() && (*it)->GetMeOp() == kMeOpVar) { // affects LPRE only; some later phase needs to transform dread to addrof auto *varMeExpr = static_cast(*it); -- Gitee