summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMLIR Team <no-reply@google.com>2019-05-03 03:08:56 -0700
committerMehdi Amini <joker.eph@gmail.com>2019-05-06 08:26:15 -0700
commit9c66417569c0a368aae565e9ead33d21f541f55a (patch)
treee00862e733c236c6bd3320b85fb37f23aa4f03e0
parent1e217ccacdecf3ad459030df4c9162c9be729db1 (diff)
downloadbcm5719-llvm-9c66417569c0a368aae565e9ead33d21f541f55a.tar.gz
bcm5719-llvm-9c66417569c0a368aae565e9ead33d21f541f55a.zip
Fix bug in LoopTiling where a loop with trip count of 1 caused a division by zero
-- PiperOrigin-RevId: 246480710
-rw-r--r--mlir/lib/Transforms/LoopTiling.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp
index 64d1839fd66..11f2468b1a9 100644
--- a/mlir/lib/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Transforms/LoopTiling.cpp
@@ -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--;
OpenPOWER on IntegriCloud