[llvm] 9bf1aea - LoopPeel: Pass through AssumptionCache (NFC)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 11:53:12 PDT 2022
Author: Matt Arsenault
Date: 2022-09-26T14:52:59-04:00
New Revision: 9bf1aea2244a75c827ac0ff9972f68804d1bdeda
URL: https://github.com/llvm/llvm-project/commit/9bf1aea2244a75c827ac0ff9972f68804d1bdeda
DIFF: https://github.com/llvm/llvm-project/commit/9bf1aea2244a75c827ac0ff9972f68804d1bdeda.diff
LOG: LoopPeel: Pass through AssumptionCache (NFC)
Added:
Modified:
llvm/include/llvm/Transforms/Utils/LoopPeel.h
llvm/lib/Transforms/Utils/LoopPeel.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/LoopPeel.h b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
index 07dabaeaa9079..d590c8c91f9e7 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopPeel.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
@@ -33,7 +33,8 @@ gatherPeelingPreferences(Loop *L, ScalarEvolution &SE,
void computePeelCount(Loop *L, unsigned LoopSize,
TargetTransformInfo::PeelingPreferences &PP,
unsigned TripCount, DominatorTree &DT,
- ScalarEvolution &SE, unsigned Threshold = UINT_MAX);
+ ScalarEvolution &SE, AssumptionCache *AC = nullptr,
+ unsigned Threshold = UINT_MAX);
} // end namespace llvm
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp
index 16007102033f8..32c24272950ee 100644
--- a/llvm/lib/Transforms/Utils/LoopPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp
@@ -161,7 +161,8 @@ static Optional<unsigned> calculateIterationsToInvariance(
// by an exit condition. Returns the number of iterations to peel off (at the
// moment either 0 or 1).
static unsigned peelToTurnInvariantLoadsDerefencebale(Loop &L,
- DominatorTree &DT) {
+ DominatorTree &DT,
+ AssumptionCache *AC) {
// Skip loops with a single exiting block, because there should be no benefit
// for the heuristic below.
if (L.getExitingBlock())
@@ -202,7 +203,7 @@ static unsigned peelToTurnInvariantLoadsDerefencebale(Loop &L,
if (auto *LI = dyn_cast<LoadInst>(&I)) {
Value *Ptr = LI->getPointerOperand();
if (DT.dominates(BB, Latch) && L.isLoopInvariant(Ptr) &&
- !isDereferenceablePointer(Ptr, LI->getType(), DL, LI, nullptr, &DT))
+ !isDereferenceablePointer(Ptr, LI->getType(), DL, LI, AC, &DT))
for (Value *U : I.users())
LoadUsers.insert(U);
}
@@ -358,7 +359,8 @@ static bool violatesLegacyMultiExitLoopCheck(Loop *L) {
void llvm::computePeelCount(Loop *L, unsigned LoopSize,
TargetTransformInfo::PeelingPreferences &PP,
unsigned TripCount, DominatorTree &DT,
- ScalarEvolution &SE, unsigned Threshold) {
+ ScalarEvolution &SE, AssumptionCache *AC,
+ unsigned Threshold) {
assert(LoopSize > 0 && "Zero loop size is not allowed!");
// Save the PP.PeelCount value set by the target in
// TTI.getPeelingPreferences or by the flag -unroll-peel-count.
@@ -429,7 +431,7 @@ void llvm::computePeelCount(Loop *L, unsigned LoopSize,
countToEliminateCompares(*L, MaxPeelCount, SE));
if (DesiredPeelCount == 0)
- DesiredPeelCount = peelToTurnInvariantLoadsDerefencebale(*L, DT);
+ DesiredPeelCount = peelToTurnInvariantLoadsDerefencebale(*L, DT, AC);
if (DesiredPeelCount > 0) {
DesiredPeelCount = std::min(DesiredPeelCount, MaxPeelCount);
More information about the llvm-commits
mailing list