Loading llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -505,8 +505,7 @@ static bool doCallSiteSplitting(Function &F, TargetLibraryInfo &TLI, DomTreeUpdater DTU(&DT, DomTreeUpdater::UpdateStrategy::Lazy); bool Changed = false; for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE;) { BasicBlock &BB = *BI++; for (BasicBlock &BB : llvm::make_early_inc_range(F)) { auto II = BB.getFirstNonPHIOrDbg()->getIterator(); auto IE = BB.getTerminator()->getIterator(); // Iterate until we reach the terminator instruction. tryToSplitCallSite Loading llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -1048,49 +1048,48 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT, // blocks. for (BasicBlock *BB : depth_first(&F.getEntryBlock())) { bool BBChanged = false; for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { Instruction *II = &*BI++; switch (II->getOpcode()) { for (Instruction &II : llvm::make_early_inc_range(*BB)) { switch (II.getOpcode()) { case Instruction::Select: BBChanged |= processSelect(cast<SelectInst>(II), LVI); BBChanged |= processSelect(cast<SelectInst>(&II), LVI); break; case Instruction::PHI: BBChanged |= processPHI(cast<PHINode>(II), LVI, DT, SQ); BBChanged |= processPHI(cast<PHINode>(&II), LVI, DT, SQ); break; case Instruction::ICmp: case Instruction::FCmp: BBChanged |= processCmp(cast<CmpInst>(II), LVI); BBChanged |= processCmp(cast<CmpInst>(&II), LVI); break; case Instruction::Load: case Instruction::Store: BBChanged |= processMemAccess(II, LVI); BBChanged |= processMemAccess(&II, LVI); break; case Instruction::Call: case Instruction::Invoke: BBChanged |= processCallSite(cast<CallBase>(*II), LVI); BBChanged |= processCallSite(cast<CallBase>(II), LVI); break; case Instruction::SRem: case Instruction::SDiv: BBChanged |= processSDivOrSRem(cast<BinaryOperator>(II), LVI); BBChanged |= processSDivOrSRem(cast<BinaryOperator>(&II), LVI); break; case Instruction::UDiv: case Instruction::URem: BBChanged |= processUDivOrURem(cast<BinaryOperator>(II), LVI); BBChanged |= processUDivOrURem(cast<BinaryOperator>(&II), LVI); break; case Instruction::AShr: BBChanged |= processAShr(cast<BinaryOperator>(II), LVI); BBChanged |= processAShr(cast<BinaryOperator>(&II), LVI); break; case Instruction::SExt: BBChanged |= processSExt(cast<SExtInst>(II), LVI); BBChanged |= processSExt(cast<SExtInst>(&II), LVI); break; case Instruction::Add: case Instruction::Sub: case Instruction::Mul: case Instruction::Shl: BBChanged |= processBinOp(cast<BinaryOperator>(II), LVI); BBChanged |= processBinOp(cast<BinaryOperator>(&II), LVI); break; case Instruction::And: BBChanged |= processAnd(cast<BinaryOperator>(II), LVI); BBChanged |= processAnd(cast<BinaryOperator>(&II), LVI); break; } } Loading llvm/lib/Transforms/Scalar/GVN.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -2460,10 +2460,8 @@ bool GVN::runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT, DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); // Merge unconditional branches, allowing PRE to catch more // optimization opportunities. for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ) { BasicBlock *BB = &*FI++; bool removedBlock = MergeBlockIntoPredecessor(BB, &DTU, LI, MSSAU, MD); for (BasicBlock &BB : llvm::make_early_inc_range(F)) { bool removedBlock = MergeBlockIntoPredecessor(&BB, &DTU, LI, MSSAU, MD); if (removedBlock) ++NumGVNBlocks; Loading llvm/lib/Transforms/Scalar/LICM.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -883,8 +883,7 @@ bool llvm::hoistRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI, if (!LoopNestMode && inSubLoop(BB, CurLoop, LI)) continue; for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) { Instruction &I = *II++; for (Instruction &I : llvm::make_early_inc_range(*BB)) { // Try constant folding this instruction. If all the operands are // constants, it is technically hoistable, but it would be better to // just fold it. Loading llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -105,9 +105,7 @@ static bool simplifyLoopInst(Loop &L, DominatorTree &DT, LoopInfo &LI, if (!V || !LI.replacementPreservesLCSSAForm(&I, V)) continue; for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE;) { Use &U = *UI++; for (Use &U : llvm::make_early_inc_range(I.uses())) { auto *UserI = cast<Instruction>(U.getUser()); U.set(V); Loading Loading
llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -505,8 +505,7 @@ static bool doCallSiteSplitting(Function &F, TargetLibraryInfo &TLI, DomTreeUpdater DTU(&DT, DomTreeUpdater::UpdateStrategy::Lazy); bool Changed = false; for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE;) { BasicBlock &BB = *BI++; for (BasicBlock &BB : llvm::make_early_inc_range(F)) { auto II = BB.getFirstNonPHIOrDbg()->getIterator(); auto IE = BB.getTerminator()->getIterator(); // Iterate until we reach the terminator instruction. tryToSplitCallSite Loading
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -1048,49 +1048,48 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT, // blocks. for (BasicBlock *BB : depth_first(&F.getEntryBlock())) { bool BBChanged = false; for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { Instruction *II = &*BI++; switch (II->getOpcode()) { for (Instruction &II : llvm::make_early_inc_range(*BB)) { switch (II.getOpcode()) { case Instruction::Select: BBChanged |= processSelect(cast<SelectInst>(II), LVI); BBChanged |= processSelect(cast<SelectInst>(&II), LVI); break; case Instruction::PHI: BBChanged |= processPHI(cast<PHINode>(II), LVI, DT, SQ); BBChanged |= processPHI(cast<PHINode>(&II), LVI, DT, SQ); break; case Instruction::ICmp: case Instruction::FCmp: BBChanged |= processCmp(cast<CmpInst>(II), LVI); BBChanged |= processCmp(cast<CmpInst>(&II), LVI); break; case Instruction::Load: case Instruction::Store: BBChanged |= processMemAccess(II, LVI); BBChanged |= processMemAccess(&II, LVI); break; case Instruction::Call: case Instruction::Invoke: BBChanged |= processCallSite(cast<CallBase>(*II), LVI); BBChanged |= processCallSite(cast<CallBase>(II), LVI); break; case Instruction::SRem: case Instruction::SDiv: BBChanged |= processSDivOrSRem(cast<BinaryOperator>(II), LVI); BBChanged |= processSDivOrSRem(cast<BinaryOperator>(&II), LVI); break; case Instruction::UDiv: case Instruction::URem: BBChanged |= processUDivOrURem(cast<BinaryOperator>(II), LVI); BBChanged |= processUDivOrURem(cast<BinaryOperator>(&II), LVI); break; case Instruction::AShr: BBChanged |= processAShr(cast<BinaryOperator>(II), LVI); BBChanged |= processAShr(cast<BinaryOperator>(&II), LVI); break; case Instruction::SExt: BBChanged |= processSExt(cast<SExtInst>(II), LVI); BBChanged |= processSExt(cast<SExtInst>(&II), LVI); break; case Instruction::Add: case Instruction::Sub: case Instruction::Mul: case Instruction::Shl: BBChanged |= processBinOp(cast<BinaryOperator>(II), LVI); BBChanged |= processBinOp(cast<BinaryOperator>(&II), LVI); break; case Instruction::And: BBChanged |= processAnd(cast<BinaryOperator>(II), LVI); BBChanged |= processAnd(cast<BinaryOperator>(&II), LVI); break; } } Loading
llvm/lib/Transforms/Scalar/GVN.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -2460,10 +2460,8 @@ bool GVN::runImpl(Function &F, AssumptionCache &RunAC, DominatorTree &RunDT, DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager); // Merge unconditional branches, allowing PRE to catch more // optimization opportunities. for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ) { BasicBlock *BB = &*FI++; bool removedBlock = MergeBlockIntoPredecessor(BB, &DTU, LI, MSSAU, MD); for (BasicBlock &BB : llvm::make_early_inc_range(F)) { bool removedBlock = MergeBlockIntoPredecessor(&BB, &DTU, LI, MSSAU, MD); if (removedBlock) ++NumGVNBlocks; Loading
llvm/lib/Transforms/Scalar/LICM.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -883,8 +883,7 @@ bool llvm::hoistRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI, if (!LoopNestMode && inSubLoop(BB, CurLoop, LI)) continue; for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) { Instruction &I = *II++; for (Instruction &I : llvm::make_early_inc_range(*BB)) { // Try constant folding this instruction. If all the operands are // constants, it is technically hoistable, but it would be better to // just fold it. Loading
llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -105,9 +105,7 @@ static bool simplifyLoopInst(Loop &L, DominatorTree &DT, LoopInfo &LI, if (!V || !LI.replacementPreservesLCSSAForm(&I, V)) continue; for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE;) { Use &U = *UI++; for (Use &U : llvm::make_early_inc_range(I.uses())) { auto *UserI = cast<Instruction>(U.getUser()); U.set(V); Loading