aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopPeel.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-09-19 17:50:00 -0400
committerMatt Arsenault <arsenm2@gmail.com>2022-09-26 14:52:59 -0400
commit9bf1aea2244a75c827ac0ff9972f68804d1bdeda (patch)
tree1d537865636ba9fcadbd088c25d17e0776eae3d7 /llvm/lib/Transforms/Utils/LoopPeel.cpp
parent53fa00b3ae4722b71622957fdab66202e2de1173 (diff)
downloadllvm-9bf1aea2244a75c827ac0ff9972f68804d1bdeda.zip
llvm-9bf1aea2244a75c827ac0ff9972f68804d1bdeda.tar.gz
llvm-9bf1aea2244a75c827ac0ff9972f68804d1bdeda.tar.bz2
LoopPeel: Pass through AssumptionCache (NFC)
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopPeel.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopPeel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp
index 1600710..32c2427 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);