forked from OSchip/llvm-project
LoopUnroll: Pass through AssumptionCache (NFC)
Using these queries with a context instruction and without a cache seems to be about 2x slower than with it so this theoretically improves compile time.
This commit is contained in:
parent
2d62833048
commit
53fa00b3ae
|
@ -100,7 +100,8 @@ bool isSafeToUnrollAndJam(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
|
|||
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,
|
||||
|
|
|
@ -3251,7 +3251,7 @@ static int32_t computeHeuristicUnrollFactor(CanonicalLoopInfo *CLI) {
|
|||
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;
|
||||
|
|
|
@ -156,7 +156,7 @@ getUnrollAndJammedLoopSize(unsigned LoopSize,
|
|||
// 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 @@ static bool computeUnrollAndJamCount(
|
|||
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 @@ tryToUnrollAndJamLoop(Loop *L, DominatorTree &DT, LoopInfo *LI,
|
|||
|
||||
// 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;
|
||||
|
|
|
@ -888,6 +888,7 @@ shouldPartialUnroll(const unsigned LoopSize, const unsigned TripCount,
|
|||
// 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 @@ bool llvm::computeUnrollCount(
|
|||
}
|
||||
|
||||
// 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 @@ static LoopUnrollResult tryToUnrollLoop(
|
|||
// 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;
|
||||
|
|
Loading…
Reference in New Issue