From 3567d3d2ecad91a135de45841f130a480d722006 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Wed, 27 Sep 2017 21:45:19 +0000 Subject: [PATCH] Rename LoopUnrollStatus to LoopUnrollResult; NFC A "Result" suffix is more appropriate here llvm-svn: 314350 --- llvm/include/llvm/Transforms/Utils/UnrollLoop.h | 4 ++-- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 6 +++--- llvm/lib/Transforms/Utils/LoopUnroll.cpp | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/llvm/include/llvm/Transforms/Utils/UnrollLoop.h b/llvm/include/llvm/Transforms/Utils/UnrollLoop.h index 1f7af92..5893726 100644 --- a/llvm/include/llvm/Transforms/Utils/UnrollLoop.h +++ b/llvm/include/llvm/Transforms/Utils/UnrollLoop.h @@ -40,7 +40,7 @@ const Loop* addClonedBlockToLoopInfo(BasicBlock *OriginalBB, NewLoopsMap &NewLoops); /// Represents the result of a \c UnrollLoop invocation. -enum class LoopUnrollStatus { +enum class LoopUnrollResult { /// The loop was not modified. Unmodified, @@ -54,7 +54,7 @@ enum class LoopUnrollStatus { FullyUnrolled }; -LoopUnrollStatus UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, +LoopUnrollResult UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, bool Force, bool AllowRuntime, bool AllowExpensiveTripCount, bool PreserveCondBr, bool PreserveOnlyFirst, unsigned TripMultiple, diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 40fcf97..4887967 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -1045,18 +1045,18 @@ static bool tryToUnrollLoop( UP.Count = TripCount; // Unroll the loop. - LoopUnrollStatus UnrollStatus = UnrollLoop( + LoopUnrollResult UnrollStatus = UnrollLoop( L, UP.Count, TripCount, UP.Force, UP.Runtime, UP.AllowExpensiveTripCount, UseUpperBound, MaxOrZero, TripMultiple, UP.PeelCount, UP.UnrollRemainder, LI, &SE, &DT, &AC, &ORE, PreserveLCSSA); - if (UnrollStatus == LoopUnrollStatus::Unmodified) + if (UnrollStatus == LoopUnrollResult::Unmodified) return false; // If loop has an unroll count pragma or unrolled by explicitly set count // mark loop as unrolled to prevent unrolling beyond that requested. // If the loop was peeled, we already "used up" the profile information // we had, so we don't want to unroll or peel again. - if (UnrollStatus != LoopUnrollStatus::FullyUnrolled && + if (UnrollStatus != LoopUnrollResult::FullyUnrolled && (IsCountSetExplicitly || UP.PeelCount)) SetLoopAlreadyUnrolled(L); diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 1e645ec..5357596 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -291,7 +291,7 @@ static bool isEpilogProfitable(Loop *L) { /// /// This utility preserves LoopInfo. It will also preserve ScalarEvolution and /// DominatorTree if they are non-null. -LoopUnrollStatus llvm::UnrollLoop( +LoopUnrollResult llvm::UnrollLoop( Loop *L, unsigned Count, unsigned TripCount, bool Force, bool AllowRuntime, bool AllowExpensiveTripCount, bool PreserveCondBr, bool PreserveOnlyFirst, unsigned TripMultiple, unsigned PeelCount, bool UnrollRemainder, @@ -301,19 +301,19 @@ LoopUnrollStatus llvm::UnrollLoop( BasicBlock *Preheader = L->getLoopPreheader(); if (!Preheader) { DEBUG(dbgs() << " Can't unroll; loop preheader-insertion failed.\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } BasicBlock *LatchBlock = L->getLoopLatch(); if (!LatchBlock) { DEBUG(dbgs() << " Can't unroll; loop exit-block-insertion failed.\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } // Loops with indirectbr cannot be cloned. if (!L->isSafeToClone()) { DEBUG(dbgs() << " Can't unroll; Loop body cannot be cloned.\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } // The current loop unroll pass can only unroll loops with a single latch @@ -327,7 +327,7 @@ LoopUnrollStatus llvm::UnrollLoop( // The loop-rotate pass can be helpful to avoid this in many cases. DEBUG(dbgs() << " Can't unroll; loop not terminated by a conditional branch.\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } auto CheckSuccessors = [&](unsigned S1, unsigned S2) { @@ -337,14 +337,14 @@ LoopUnrollStatus llvm::UnrollLoop( if (!CheckSuccessors(0, 1) && !CheckSuccessors(1, 0)) { DEBUG(dbgs() << "Can't unroll; only loops with one conditional latch" " exiting the loop can be unrolled\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } if (Header->hasAddressTaken()) { // The loop-rotate pass can be helpful to avoid this in many cases. DEBUG(dbgs() << " Won't unroll loop: address of header block is taken.\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } if (TripCount != 0) @@ -360,7 +360,7 @@ LoopUnrollStatus llvm::UnrollLoop( // Don't enter the unroll code if there is nothing to do. if (TripCount == 0 && Count < 2 && PeelCount == 0) { DEBUG(dbgs() << "Won't unroll; almost nothing to do\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } assert(Count > 0); @@ -436,7 +436,7 @@ LoopUnrollStatus llvm::UnrollLoop( DEBUG( dbgs() << "Wont unroll; remainder loop could not be generated" "when assuming runtime trip count\n"); - return LoopUnrollStatus::Unmodified; + return LoopUnrollResult::Unmodified; } } @@ -861,8 +861,8 @@ LoopUnrollStatus llvm::UnrollLoop( } } - return CompletelyUnroll ? LoopUnrollStatus::FullyUnrolled - : LoopUnrollStatus::PartiallyUnrolled; + return CompletelyUnroll ? LoopUnrollResult::FullyUnrolled + : LoopUnrollResult::PartiallyUnrolled; } /// Given an llvm.loop loop id metadata node, returns the loop hint metadata -- 2.7.4