Fix -Wsign-compare in Toy LateLowering.
authorJacques Pienaar <jpienaar@google.com>
Mon, 13 May 2019 21:04:17 +0000 (14:04 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 20 May 2019 20:40:33 +0000 (13:40 -0700)
--

PiperOrigin-RevId: 248005642

mlir/examples/toy/Ch5/mlir/LateLowering.cpp

index 862ea21..b54c7d8 100644 (file)
@@ -249,7 +249,7 @@ public:
     ScopedContext scope(rewriter, loc);
     MemRefView vOp(result);
     IndexedValue iOp(result);
-    for (uint64_t i = 0; i < shape[0]; ++i) {
+    for (uint64_t i = 0, ie = shape[0]; i < ie; ++i) {
       if (shape.size() == 1) {
         auto value = cstValue.getValue(ArrayRef<uint64_t>{i})
                          .cast<FloatAttr>()
@@ -257,7 +257,7 @@ public:
         iOp(constant_index(i)) = constant_float(value, f64Ty);
         continue;
       }
-      for (uint64_t j = 0; j < shape[1]; ++j) {
+      for (uint64_t j = 0, je = shape[1]; j < je; ++j) {
         auto value = cstValue.getValue(ArrayRef<uint64_t>{i, j})
                          .cast<FloatAttr>()
                          .getValue();