@@ -200,6 +200,7 @@ TargetTransformInfo::UnrollingPreferences llvm::gatherUnrollingPreferences(
200
200
UP.Count = 0 ;
201
201
UP.DefaultUnrollRuntimeCount = 8 ;
202
202
UP.MaxCount = std::numeric_limits<unsigned >::max ();
203
+ UP.MaxUpperBound = UnrollMaxUpperBound;
203
204
UP.FullUnrollMaxCount = std::numeric_limits<unsigned >::max ();
204
205
UP.BEInsns = 2 ;
205
206
UP.Partial = false ;
@@ -237,6 +238,8 @@ TargetTransformInfo::UnrollingPreferences llvm::gatherUnrollingPreferences(
237
238
UP.MaxPercentThresholdBoost = UnrollMaxPercentThresholdBoost;
238
239
if (UnrollMaxCount.getNumOccurrences () > 0 )
239
240
UP.MaxCount = UnrollMaxCount;
241
+ if (UnrollMaxUpperBound.getNumOccurrences () > 0 )
242
+ UP.MaxUpperBound = UnrollMaxUpperBound;
240
243
if (UnrollFullMaxCount.getNumOccurrences () > 0 )
241
244
UP.FullUnrollMaxCount = UnrollFullMaxCount;
242
245
if (UnrollAllowPartial.getNumOccurrences () > 0 )
@@ -777,7 +780,7 @@ shouldPragmaUnroll(Loop *L, const PragmaInfo &PInfo,
777
780
return TripCount;
778
781
779
782
if (PInfo.PragmaEnableUnroll && !TripCount && MaxTripCount &&
780
- MaxTripCount <= UnrollMaxUpperBound )
783
+ MaxTripCount <= UP. MaxUpperBound )
781
784
return MaxTripCount;
782
785
783
786
// if didn't return until here, should continue to other priorties
@@ -952,7 +955,7 @@ bool llvm::computeUnrollCount(
952
955
// cost of exact full unrolling. As such, if we have an exact count and
953
956
// found it unprofitable, we'll never chose to bounded unroll.
954
957
if (!TripCount && MaxTripCount && (UP.UpperBound || MaxOrZero) &&
955
- MaxTripCount <= UnrollMaxUpperBound ) {
958
+ MaxTripCount <= UP. MaxUpperBound ) {
956
959
UP.Count = MaxTripCount;
957
960
if (auto UnrollFactor = shouldFullUnroll (L, TTI, DT, SE, EphValues,
958
961
MaxTripCount, UCE, UP)) {
@@ -1026,7 +1029,7 @@ bool llvm::computeUnrollCount(
1026
1029
}
1027
1030
1028
1031
// Don't unroll a small upper bound loop unless user or TTI asked to do so.
1029
- if (MaxTripCount && !UP.Force && MaxTripCount < UnrollMaxUpperBound ) {
1032
+ if (MaxTripCount && !UP.Force && MaxTripCount < UP. MaxUpperBound ) {
1030
1033
UP.Count = 0 ;
1031
1034
return false ;
1032
1035
}
0 commit comments