Fix bug in LoopTiling where a loop with trip count of 1 caused a division by zero

--

PiperOrigin-RevId: 246480710
This commit is contained in:
MLIR Team 2019-05-03 03:08:56 -07:00 committed by Mehdi Amini
parent 1e217ccacd
commit 9c66417569
1 changed files with 1 additions and 1 deletions

View File

@ -293,7 +293,7 @@ static void adjustToDivisorsOfTripCounts(ArrayRef<AffineForOp> band,
// Adjust the tile size to largest factor of the trip count less than
// tSize.
uint64_t constTripCount = mayConst.getValue();
if (tSizeAdjusted > constTripCount / 2)
if (constTripCount > 1 && tSizeAdjusted > constTripCount / 2)
tSizeAdjusted = constTripCount / 2;
while (constTripCount % tSizeAdjusted != 0)
tSizeAdjusted--;