In PR21409 ( http://llvm.org/bugs/show_bug.cgi?id=21409 ), the loop unroller tries to transform a loop with a backedge count of i32 4294967295. Adding 1 to that causes an overflow of the SCEV value for the trip count. This patch adds a check to prevent unrolling that type of loop.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
So this solves the constant-trip-count case, do we have the same problem at runtime if the backedge count dynamically takes the maximum value?
Comment Actions
This change actually is in the runtime unroller...why we're getting here for a compile-time constant loop is another bug?
In the compile-time unroller, we do this check:
TripCount = SE->getSmallConstantTripCount(L, ExitingBlock);
And getSmallConstantTripCount() has this:
// In case of integer overflow, this returns 0, which is correct. return ((unsigned)ExitConst->getZExtValue()) + 1;
Comment Actions
The runtime unroller also does partial unrolling of large-trip-count loops. So we're probably in the right place (UINT_MAX is certainly above the full-unrolling limit).
Comment Actions
Abandoning - better patch checked in at:
http://llvm.org/viewvc/llvm-project?view=revision&revision=222451