[PATCH] D134239: LoopUnroll: Pass through AssumptionCache
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 19 16:34:57 PDT 2022
arsenm created this revision.
arsenm added reviewers: jdoerfert, reames, fhahn, annatom.
Herald added subscribers: zzheng, hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
https://reviews.llvm.org/D134239
Files:
llvm/include/llvm/Transforms/Utils/UnrollLoop.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
Index: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -888,6 +888,7 @@
// refactored into it own function.
bool llvm::computeUnrollCount(
Loop *L, const TargetTransformInfo &TTI, DominatorTree &DT, LoopInfo *LI,
+ AssumptionCache *AC,
ScalarEvolution &SE, const SmallPtrSetImpl<const Value *> &EphValues,
OptimizationRemarkEmitter *ORE, unsigned TripCount, unsigned MaxTripCount,
bool MaxOrZero, unsigned TripMultiple, unsigned LoopSize,
@@ -978,7 +979,7 @@
}
// 5th priority is loop peeling.
- computePeelCount(L, LoopSize, PP, TripCount, DT, SE, UP.Threshold);
+ computePeelCount(L, LoopSize, PP, TripCount, DT, SE, AC, UP.Threshold);
if (PP.PeelCount) {
UP.Runtime = false;
UP.Count = 1;
@@ -1272,7 +1273,7 @@
// fully unroll the loop.
bool UseUpperBound = false;
bool IsCountSetExplicitly = computeUnrollCount(
- L, TTI, DT, LI, SE, EphValues, &ORE, TripCount, MaxTripCount, MaxOrZero,
+ L, TTI, DT, LI, &AC, SE, EphValues, &ORE, TripCount, MaxTripCount, MaxOrZero,
TripMultiple, LoopSize, UP, PP, UseUpperBound);
if (!UP.Count)
return LoopUnrollResult::Unmodified;
Index: llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
+++ llvm/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp
@@ -156,7 +156,7 @@
// unroll count was set explicitly.
static bool computeUnrollAndJamCount(
Loop *L, Loop *SubLoop, const TargetTransformInfo &TTI, DominatorTree &DT,
- LoopInfo *LI, ScalarEvolution &SE,
+ LoopInfo *LI, AssumptionCache *AC, ScalarEvolution &SE,
const SmallPtrSetImpl<const Value *> &EphValues,
OptimizationRemarkEmitter *ORE, unsigned OuterTripCount,
unsigned OuterTripMultiple, unsigned OuterLoopSize, unsigned InnerTripCount,
@@ -170,7 +170,7 @@
unsigned MaxTripCount = 0;
bool UseUpperBound = false;
bool ExplicitUnroll = computeUnrollCount(
- L, TTI, DT, LI, SE, EphValues, ORE, OuterTripCount, MaxTripCount,
+ L, TTI, DT, LI, AC, SE, EphValues, ORE, OuterTripCount, MaxTripCount,
/*MaxOrZero*/ false, OuterTripMultiple, OuterLoopSize, UP, PP,
UseUpperBound);
if (ExplicitUnroll || UseUpperBound) {
@@ -384,7 +384,7 @@
// Decide if, and by how much, to unroll
bool IsCountSetExplicitly = computeUnrollAndJamCount(
- L, SubLoop, TTI, DT, LI, SE, EphValues, &ORE, OuterTripCount,
+ L, SubLoop, TTI, DT, LI, &AC, SE, EphValues, &ORE, OuterTripCount,
OuterTripMultiple, OuterLoopSize, InnerTripCount, InnerLoopSize, UP, PP);
if (UP.Count <= 1)
return LoopUnrollResult::Unmodified;
Index: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
===================================================================
--- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3211,7 +3211,7 @@
unsigned TripMultiple = 0;
bool UseUpperBound = false;
- computeUnrollCount(L, TTI, DT, &LI, SE, EphValues, &ORE, TripCount,
+ computeUnrollCount(L, TTI, DT, &LI, &AC, SE, EphValues, &ORE, TripCount,
MaxTripCount, MaxOrZero, TripMultiple, LoopSize, UP, PP,
UseUpperBound);
unsigned Factor = UP.Count;
Index: llvm/include/llvm/Transforms/Utils/UnrollLoop.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/UnrollLoop.h
+++ llvm/include/llvm/Transforms/Utils/UnrollLoop.h
@@ -100,7 +100,8 @@
DependenceInfo &DI, LoopInfo &LI);
bool computeUnrollCount(Loop *L, const TargetTransformInfo &TTI,
- DominatorTree &DT, LoopInfo *LI, ScalarEvolution &SE,
+ DominatorTree &DT, LoopInfo *LI, AssumptionCache *AC,
+ ScalarEvolution &SE,
const SmallPtrSetImpl<const Value *> &EphValues,
OptimizationRemarkEmitter *ORE, unsigned TripCount,
unsigned MaxTripCount, bool MaxOrZero,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134239.461412.patch
Type: text/x-patch
Size: 4237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/20421468/attachment.bin>
More information about the llvm-commits
mailing list