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,13 +1410,13 @@ Worklist.clear(); Worklist.insert(ChangedAAs.begin(), ChangedAAs.end()); - } while (!Worklist.empty() && (IterationCounter++ < MaxFixedPointIterations || + } 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(); @@ -1426,7 +1424,7 @@ } 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 +1459,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);