aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopPeel.cpp
diff options
context:
space:
mode:
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);