Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Transforms/Scalar/LoopUnrollPass.cpp | ||
|---|---|---|
| 813 ↗ | (On Diff #103633) | This check should actually be present along all paths from this function? |
| 839 ↗ | (On Diff #103633) | What happens if we early return from this function with result as true, but UP.Count > UP.MaxCount? Perhaps we should be setting the max value at the caller of this function : tryToUnrollLoop() {
....
// computeUnrollCount() decides whether it is beneficial to use upper bound to fully
// unroll the loop.
bool UseUpperBound = false;
bool IsCountSetExplicitly =
computeUnrollCount(L, TTI, DT, LI, SE, &ORE, TripCount, MaxTripCount,
TripMultiple, LoopSize, UP, UseUpperBound);
if (!UP.Count)
return false;
// Unroll factor (Count) must be less or equal to TripCount.
if (TripCount && UP.Count > TripCount)
UP.Count = TripCount;
// Add the check after this?
} |
| lib/Transforms/Scalar/LoopUnrollPass.cpp | ||
|---|---|---|
| 839 ↗ | (On Diff #103633) | I think this is the only place that MaxCount wasn't being honored where it should be. The earlier checks that return early are:
|
Comment Actions
LGTM.
Just clarifying: this just honours the user defined max count right (if user hasn't defined the value, it would be UINT_MAX).
Comment Actions
That, or the value set by the target hook getUnrollingPreferences(), which is how I originally ran into the bug, when implementing D34533