Index: llvm/include/llvm/Transforms/IPO/Attributor.h =================================================================== --- llvm/include/llvm/Transforms/IPO/Attributor.h +++ llvm/include/llvm/Transforms/IPO/Attributor.h @@ -1157,7 +1157,7 @@ : Allocator(InfoCache.Allocator), Functions(Functions), InfoCache(InfoCache), CGUpdater(CGUpdater), Allowed(Allowed), DeleteFns(DeleteFns), RewriteSignatures(RewriteSignatures), - MaxFixpointIterations(None), OREGetter(None), PassName("") {} + MaxFixedpointIterations(None), OREGetter(None), PassName("") {} /// Constructor /// @@ -1168,7 +1168,7 @@ /// \param Allowed If not null, a set limiting the attribute opportunities. /// \param DeleteFns Whether to delete functions /// \param RewriteSignatures Whether to rewrite function signatures. - /// \param MaxFixpointIterations Maximum number of iterations to run until + /// \param MaxFixedpointIterations Maximum number of iterations to run until /// fixpoint. /// \param OREGetter A callback function that returns an ORE object from a /// Function pointer. @@ -1176,12 +1176,12 @@ Attributor(SetVector &Functions, InformationCache &InfoCache, CallGraphUpdater &CGUpdater, DenseSet *Allowed, bool DeleteFns, bool RewriteSignatures, - Optional MaxFixpointIterations, + Optional MaxFixedpointIterations, OptimizationRemarkGetter OREGetter, const char *PassName) : Allocator(InfoCache.Allocator), Functions(Functions), InfoCache(InfoCache), CGUpdater(CGUpdater), Allowed(Allowed), DeleteFns(DeleteFns), RewriteSignatures(RewriteSignatures), - MaxFixpointIterations(MaxFixpointIterations), + MaxFixedpointIterations(MaxFixedpointIterations), OREGetter(Optional(OREGetter)), PassName(PassName) {} @@ -2005,7 +2005,7 @@ const bool RewriteSignatures; /// Maximum number of fixedpoint iterations. - Optional MaxFixpointIterations; + Optional MaxFixedpointIterations; /// A set to remember the functions we already assume to be live and visited. DenseSet VisitedFunctions; Index: llvm/lib/Transforms/IPO/Attributor.cpp =================================================================== --- llvm/lib/Transforms/IPO/Attributor.cpp +++ llvm/lib/Transforms/IPO/Attributor.cpp @@ -1327,17 +1327,15 @@ // Now that all abstract attributes are collected and initialized we start // the abstract analysis. - unsigned IterationCounter = 1; - unsigned MaxFixedPointIterations; - if (MaxFixpointIterations) - MaxFixedPointIterations = MaxFixpointIterations.getValue(); - else - MaxFixedPointIterations = SetFixpointIterations; - SmallVector ChangedAAs; SetVector Worklist, InvalidAAs; Worklist.insert(DG.SyntheticRoot.begin(), DG.SyntheticRoot.end()); + unsigned MaxFixedpointIterationsValue = + MaxFixedpointIterations ? MaxFixedpointIterations.getValue() + : SetFixpointIterations; + unsigned IterationCounter = 1; + do { // Remember the size to determine new attributes. size_t NumAAs = DG.SyntheticRoot.Deps.size(); @@ -1412,21 +1410,22 @@ Worklist.clear(); Worklist.insert(ChangedAAs.begin(), ChangedAAs.end()); - } while (!Worklist.empty() && (IterationCounter++ < MaxFixedPointIterations || - VerifyMaxFixpointIterations)); + } while (!Worklist.empty() && + (IterationCounter++ < MaxFixedpointIterationsValue || + VerifyMaxFixpointIterations)); - if (IterationCounter > MaxFixedPointIterations && !Worklist.empty()) { + if (IterationCounter > MaxFixedpointIterationsValue && !Worklist.empty()) { auto Remark = [&](OptimizationRemarkMissed ORM) { return ORM << "Attributor did not reach a fixpoint after " - << ore::NV("Iterations", MaxFixedPointIterations) + << ore::NV("Iterations", MaxFixedpointIterationsValue) << " iterations."; }; Function *F = Worklist.front()->getIRPosition().getAssociatedFunction(); - emitRemark(F, "FixedPoint", Remark); + emitRemark(F, "Fixedpoint", Remark); } LLVM_DEBUG(dbgs() << "\n[Attributor] Fixpoint iteration done after: " - << IterationCounter << "/" << MaxFixpointIterations + << IterationCounter << "/" << MaxFixedpointIterations << " iterations\n"); // Reset abstract arguments not settled in a sound fixpoint by now. This @@ -1461,9 +1460,9 @@ }); if (VerifyMaxFixpointIterations && - IterationCounter != MaxFixedPointIterations) { + IterationCounter != MaxFixedpointIterationsValue) { errs() << "\n[Attributor] Fixpoint iteration done after: " - << IterationCounter << "/" << MaxFixedPointIterations + << IterationCounter << "/" << MaxFixedpointIterationsValue << " iterations\n"; llvm_unreachable("The fixpoint was not reached with exactly the number of " "specified iterations!"); Index: llvm/lib/Transforms/IPO/OpenMPOpt.cpp =================================================================== --- llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -4589,10 +4589,10 @@ SetVector Functions(SCC.begin(), SCC.end()); OMPInformationCache InfoCache(M, AG, Allocator, /*CGSCC*/ Functions, Kernels); - unsigned MaxFixpointIterations = + unsigned MaxFixedpointIterations = (isOpenMPDevice(M)) ? SetFixpointIterations : 32; Attributor A(Functions, InfoCache, CGUpdater, nullptr, true, false, - MaxFixpointIterations, OREGetter, DEBUG_TYPE); + MaxFixedpointIterations, OREGetter, DEBUG_TYPE); OpenMPOpt OMPOpt(SCC, CGUpdater, OREGetter, InfoCache, A); bool Changed = OMPOpt.run(true); @@ -4653,10 +4653,10 @@ OMPInformationCache InfoCache(*(Functions.back()->getParent()), AG, Allocator, /*CGSCC*/ Functions, Kernels); - unsigned MaxFixpointIterations = + unsigned MaxFixedpointIterations = (isOpenMPDevice(M)) ? SetFixpointIterations : 32; Attributor A(Functions, InfoCache, CGUpdater, nullptr, false, true, - MaxFixpointIterations, OREGetter, DEBUG_TYPE); + MaxFixedpointIterations, OREGetter, DEBUG_TYPE); OpenMPOpt OMPOpt(SCC, CGUpdater, OREGetter, InfoCache, A); bool Changed = OMPOpt.run(false); @@ -4724,10 +4724,10 @@ Allocator, /*CGSCC*/ Functions, Kernels); - unsigned MaxFixpointIterations = + unsigned MaxFixedpointIterations = (isOpenMPDevice(M)) ? SetFixpointIterations : 32; Attributor A(Functions, InfoCache, CGUpdater, nullptr, false, true, - MaxFixpointIterations, OREGetter, DEBUG_TYPE); + MaxFixedPointIterations, OREGetter, DEBUG_TYPE); OpenMPOpt OMPOpt(SCC, CGUpdater, OREGetter, InfoCache, A); bool Result = OMPOpt.run(false);