Fix up some mixed sign warnings.
authorJacques Pienaar <jpienaar@google.com>
Sat, 4 May 2019 02:48:57 +0000 (19:48 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 6 May 2019 15:28:20 +0000 (08:28 -0700)
--

PiperOrigin-RevId: 246614498

12 files changed:
mlir/include/mlir/TableGen/Pattern.h
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/Attributes.cpp
mlir/lib/StandardOps/Ops.cpp
mlir/lib/TableGen/Pattern.cpp
mlir/lib/Transforms/LoopFusion.cpp
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
mlir/test/mlir-tblgen/op-operand.td
mlir/test/mlir-tblgen/op-result.td
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp

index e833e49..1b75712 100644 (file)
@@ -144,10 +144,10 @@ public:
 
   // Returns the number of operations recursively involved in the DAG tree
   // rooted from this node.
-  unsigned getNumOps() const;
+  int getNumOps() const;
 
   // Returns the number of immediate arguments to this DAG node.
-  unsigned getNumArgs() const;
+  int getNumArgs() const;
 
   // Returns true if the `index`-th argument is a nested DAG construct.
   bool isNestedDagArg(unsigned index) const;
@@ -192,7 +192,7 @@ public:
   DagNode getSourcePattern() const;
 
   // Returns the number of results generated by applying this rewrite pattern.
-  unsigned getNumResults() const;
+  int getNumResults() const;
 
   // Returns the DAG tree root node of the `index`-th result pattern.
   DagNode getResultPattern(unsigned index) const;
index 5ffc749..b98b4b8 100644 (file)
@@ -429,7 +429,7 @@ void FlatAffineConstraints::addId(IdKind kind, unsigned pos, Value *id) {
     numReservedCols++;
   }
 
-  unsigned absolutePos;
+  int absolutePos;
 
   if (kind == IdKind::Dimension) {
     absolutePos = pos;
index 03fb5c6..a86821f 100644 (file)
@@ -1099,7 +1099,7 @@ void ModulePrinter::printIntegerSet(IntegerSet set) {
 
   // Print constraints.
   os << " : (";
-  auto numConstraints = set.getNumConstraints();
+  int numConstraints = set.getNumConstraints();
   for (int i = 1; i < numConstraints; ++i) {
     printAffineConstraint(set.getConstraint(i - 1), set.isEq(i - 1));
     os << ", ";
index e4b5b78..c69cb2b 100644 (file)
@@ -433,19 +433,19 @@ Attribute DenseElementsAttr::getValue(ArrayRef<uint64_t> index) const {
 
   // Verify that the rank of the indices matches the held type.
   auto rank = type.getRank();
-  if (rank != index.size())
+  if (static_cast<size_t>(rank) != index.size())
     return Attribute();
 
   // Verify that all of the indices are within the shape dimensions.
   auto shape = type.getShape();
   for (unsigned i = 0; i != rank; ++i)
-    if (shape[i] <= index[i])
+    if (shape[i] <= static_cast<int64_t>(index[i]))
       return Attribute();
 
   // Reduce the provided multidimensional index into a 1D index.
   uint64_t valueIndex = 0;
   uint64_t dimMultiplier = 1;
-  for (auto i = rank - 1; i >= 0; --i) {
+  for (int i = rank - 1; i >= 0; --i) {
     valueIndex += index[i] * dimMultiplier;
     dimMultiplier *= shape[i];
   }
@@ -701,7 +701,7 @@ Attribute SparseElementsAttr::getValue(ArrayRef<uint64_t> index) const {
   auto type = getType();
 
   // Verify that the rank of the indices matches the held type.
-  auto rank = type.getRank();
+  size_t rank = type.getRank();
   if (rank != index.size())
     return Attribute();
 
@@ -715,8 +715,7 @@ Attribute SparseElementsAttr::getValue(ArrayRef<uint64_t> index) const {
   llvm::SmallDenseMap<llvm::ArrayRef<uint64_t>, size_t> mappedIndices;
   auto numSparseIndices = sparseIndices.getType().getDimSize(0);
   for (size_t i = 0, e = numSparseIndices; i != e; ++i)
-    mappedIndices.try_emplace(
-        {sparseIndexValues + (i * rank), static_cast<size_t>(rank)}, i);
+    mappedIndices.try_emplace({sparseIndexValues + (i * rank), rank}, i);
 
   // Look for the provided index key within the mapped indices. If the provided
   // index is not found, then return a zero attribute.
index 4cc192b..46baa74 100644 (file)
@@ -1153,7 +1153,7 @@ LogicalResult DimOp::verify() {
 
   auto type = getOperand()->getType();
   if (auto tensorType = type.dyn_cast<RankedTensorType>()) {
-    if (index >= tensorType.getRank())
+    if (index >= static_cast<uint64_t>(tensorType.getRank()))
       return emitOpError("index is out of range");
   } else if (auto memrefType = type.dyn_cast<MemRefType>()) {
     if (index >= memrefType.getRank())
index ff0150d..d4ba6cd 100644 (file)
@@ -114,16 +114,16 @@ Operator &tblgen::DagNode::getDialectOp(RecordOperatorMap *mapper) const {
               .first->second;
 }
 
-unsigned tblgen::DagNode::getNumOps() const {
-  unsigned count = isReplaceWithValue() ? 0 : 1;
-  for (unsigned i = 0, e = getNumArgs(); i != e; ++i) {
+int tblgen::DagNode::getNumOps() const {
+  int count = isReplaceWithValue() ? 0 : 1;
+  for (int i = 0, e = getNumArgs(); i != e; ++i) {
     if (auto child = getArgAsNestedDag(i))
       count += child.getNumOps();
   }
   return count;
 }
 
-unsigned tblgen::DagNode::getNumArgs() const { return node->getNumArgs(); }
+int tblgen::DagNode::getNumArgs() const { return node->getNumArgs(); }
 
 bool tblgen::DagNode::isNestedDagArg(unsigned index) const {
   return isa<llvm::DagInit>(node->getArg(index));
@@ -161,7 +161,7 @@ tblgen::DagNode tblgen::Pattern::getSourcePattern() const {
   return tblgen::DagNode(def.getValueAsDag("sourcePattern"));
 }
 
-unsigned tblgen::Pattern::getNumResults() const {
+int tblgen::Pattern::getNumResults() const {
   auto *results = def.getValueAsListInit("resultPatterns");
   return results->size();
 }
@@ -248,7 +248,7 @@ void tblgen::Pattern::collectBoundArguments(DagNode tree) {
     boundOps.insert(treeName);
 
   // TODO(jpienaar): Expand to multiple matches.
-  for (unsigned i = 0; i != numTreeArgs; ++i) {
+  for (int i = 0; i != numTreeArgs; ++i) {
     if (auto treeArg = tree.getArgAsNestedDag(i)) {
       // This DAG node argument is a DAG node itself. Go inside recursively.
       collectBoundArguments(treeArg);
index f8db53a..fda6574 100644 (file)
@@ -1676,7 +1676,7 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
                             << "   fused mem: " << fusedMem << "\n"
                             << "   slice mem: " << sliceMemEstimate << "\n");
 
-    if (fusedMem > srcMemSizeVal + dstMemSizeVal) {
+    if (static_cast<long>(fusedMem) > srcMemSizeVal + dstMemSizeVal) {
       LLVM_DEBUG(llvm::dbgs() << "Fusion is not profitable; NOT fusing.\n");
       return false;
     }
index 8c6a932..3fd44c7 100644 (file)
@@ -53,7 +53,7 @@ public:
 
   /// Perform the rewrites. Return true if the rewrite converges in
   /// `maxIterations`.
-  bool simplifyFunction(unsigned maxIterations);
+  bool simplifyFunction(int maxIterations);
 
   void addToWorklist(Operation *op) {
     // Check to see if the worklist already contains this op.
@@ -146,7 +146,7 @@ private:
 }; // end anonymous namespace
 
 /// Perform the rewrites.
-bool GreedyPatternRewriteDriver::simplifyFunction(unsigned maxIterations) {
+bool GreedyPatternRewriteDriver::simplifyFunction(int maxIterations) {
   Function *fn = builder.getFunction();
   ConstantFoldHelper helper(fn);
 
index 6416905..89f260f 100644 (file)
@@ -41,13 +41,13 @@ def OpC : NS_Op<"all_variadic_inputs_op", [SameVariadicOperandSize]> {
 }
 
 // CHECK-LABEL: Operation::operand_range OpC::input1()
-// CHECK-NEXT:    unsigned variadicOperandSize = (this->getNumOperands() - 0) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicOperandSize * 0;
+// CHECK-NEXT:    variadicOperandSize = (this->getNumOperands() - 0) / 2;
+// CHECK-NEXT:    offset = 0 + variadicOperandSize * 0;
 // CHECK-NEXT:    return {std::next(operand_begin(), offset), std::next(operand_begin(), offset + variadicOperandSize)};
 
 // CHECK-LABEL: Operation::operand_range OpC::input2()
-// CHECK-NEXT:    unsigned variadicOperandSize = (this->getNumOperands() - 0) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicOperandSize * 1;
+// CHECK-NEXT:    variadicOperandSize = (this->getNumOperands() - 0) / 2;
+// CHECK-NEXT:    offset = 0 + variadicOperandSize * 1;
 // CHECK-NEXT:    return {std::next(operand_begin(), offset), std::next(operand_begin(), offset + variadicOperandSize)};
 
 // CHECK-LABEL: OpC::build
@@ -59,18 +59,18 @@ def OpD : NS_Op<"mix_variadic_and_normal_inputs_op", [SameVariadicOperandSize]>
 }
 
 // CHECK-LABEL: Operation::operand_range OpD::input1()
-// CHECK-NEXT:    unsigned variadicOperandSize = (this->getNumOperands() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicOperandSize * 0;
+// CHECK-NEXT:    variadicOperandSize = (this->getNumOperands() - 1) / 2;
+// CHECK-NEXT:    offset = 0 + variadicOperandSize * 0;
 // CHECK-NEXT:    return {std::next(operand_begin(), offset), std::next(operand_begin(), offset + variadicOperandSize)};
 
 // CHECK-LABEL: Value *OpD::input2()
-// CHECK-NEXT:    unsigned variadicOperandSize = (this->getNumOperands() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicOperandSize * 1;
+// CHECK-NEXT:    variadicOperandSize = (this->getNumOperands() - 1) / 2;
+// CHECK-NEXT:    offset = 0 + variadicOperandSize * 1;
 // CHECK-NEXT:    return this->getOperand(offset);
 
 // CHECK-LABEL: Operation::operand_range OpD::input3()
-// CHECK-NEXT:    unsigned variadicOperandSize = (this->getNumOperands() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 1 + variadicOperandSize * 1;
+// CHECK-NEXT:    variadicOperandSize = (this->getNumOperands() - 1) / 2;
+// CHECK-NEXT:    offset = 1 + variadicOperandSize * 1;
 // CHECK-NEXT:    return {std::next(operand_begin(), offset), std::next(operand_begin(), offset + variadicOperandSize)};
 
 // CHECK-LABEL: OpD::build
index 1adfef8..268f0c0 100644 (file)
@@ -98,13 +98,13 @@ def OpH : NS_Op<"all_variadic_results_op", [SameVariadicResultSize]> {
 }
 
 // CHECK-LABEL: Operation::result_range OpH::output1()
-// CHECK-NEXT:      unsigned variadicResultSize = (this->getNumResults() - 0) / 2;
-// CHECK-NEXT:      unsigned offset = 0 + variadicResultSize * 0;
+// CHECK-NEXT:      variadicResultSize = (this->getNumResults() - 0) / 2;
+// CHECK-NEXT:      offset = 0 + variadicResultSize * 0;
 // CHECK-NEXT:      return {std::next(result_begin(), offset), std::next(result_begin(), offset + variadicResultSize)};
 
 // CHECK-LABEL: Operation::result_range OpH::output2()
-// CHECK-NEXT:      unsigned variadicResultSize = (this->getNumResults() - 0) / 2;
-// CHECK-NEXT:      unsigned offset = 0 + variadicResultSize * 1;
+// CHECK-NEXT:      variadicResultSize = (this->getNumResults() - 0) / 2;
+// CHECK-NEXT:      offset = 0 + variadicResultSize * 1;
 // CHECK-NEXT:      return {std::next(result_begin(), offset), std::next(result_begin(), offset + variadicResultSize)};
 
 
@@ -117,18 +117,18 @@ def OpI : NS_Op<"mix_variadic_and_normal_results_op", [SameVariadicResultSize]>
 }
 
 // CHECK-LABEL: Operation::result_range OpI::output1()
-// CHECK-NEXT:    unsigned variadicResultSize = (this->getNumResults() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicResultSize * 0;
+// CHECK-NEXT:    variadicResultSize = (this->getNumResults() - 1) / 2;
+// CHECK-NEXT:    offset = 0 + variadicResultSize * 0;
 // CHECK-NEXT:    return {std::next(result_begin(), offset), std::next(result_begin(), offset + variadicResultSize)};
 
 // CHECK-LABEL: Value *OpI::output2()
-// CHECK-NEXT:    unsigned variadicResultSize = (this->getNumResults() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 0 + variadicResultSize * 1;
+// CHECK-NEXT:    variadicResultSize = (this->getNumResults() - 1) / 2;
+// CHECK-NEXT:    offset = 0 + variadicResultSize * 1;
 // CHECK-NEXT:    return this->getResult(offset);
 
 // CHECK-LABEL: Operation::result_range OpI::output3()
-// CHECK-NEXT:    unsigned variadicResultSize = (this->getNumResults() - 1) / 2;
-// CHECK-NEXT:    unsigned offset = 1 + variadicResultSize * 1;
+// CHECK-NEXT:    variadicResultSize = (this->getNumResults() - 1) / 2;
+// CHECK-NEXT:    offset = 1 + variadicResultSize * 1;
 // CHECK-NEXT:    return {std::next(result_begin(), offset), std::next(result_begin(), offset + variadicResultSize)};
 
 // CHECK-LABEL: OpI::build
index 58f735c..1a31673 100644 (file)
@@ -461,9 +461,9 @@ void OpEmitter::genAttrGetters() {
 }
 
 void OpEmitter::genNamedOperandGetters() {
-  const unsigned numOperands = op.getNumOperands();
-  const unsigned numVariadicOperands = op.getNumVariadicOperands();
-  const unsigned numNormalOperands = numOperands - numVariadicOperands;
+  const int numOperands = op.getNumOperands();
+  const int numVariadicOperands = op.getNumVariadicOperands();
+  const int numNormalOperands = numOperands - numVariadicOperands;
 
   // Special case for ops without variadic operands: the i-th value is for the
   // i-th operand defined in the op.
@@ -473,7 +473,7 @@ void OpEmitter::genNamedOperandGetters() {
   // operand.
   if (numVariadicOperands <= 1) {
     bool emittedVariadicOperand = false;
-    for (unsigned i = 0; i != numOperands; ++i) {
+    for (int i = 0; i != numOperands; ++i) {
       const auto &operand = op.getOperand(i);
       if (operand.name.empty())
         continue;
@@ -506,17 +506,17 @@ void OpEmitter::genNamedOperandGetters() {
                                  "specification over their sizes");
   }
 
-  unsigned emittedNormalOperands = 0;
-  unsigned emittedVariadicOperands = 0;
+  int emittedNormalOperands = 0;
+  int emittedVariadicOperands = 0;
 
-  for (unsigned i = 0; i != numOperands; ++i) {
+  for (int i = 0; i != numOperands; ++i) {
     const auto &operand = op.getOperand(i);
     if (operand.name.empty())
       continue;
 
     const char *code = R"(
-  unsigned variadicOperandSize = (this->getNumOperands() - {0}) / {1};
-  unsigned offset = {2} + variadicOperandSize * {3};
+  int variadicOperandSize = (this->getNumOperands() - {0}) / {1};
+  int offset = {2} + variadicOperandSize * {3};
   return )";
     auto sizeAndOffset =
         formatv(code, numNormalOperands, numVariadicOperands,
@@ -537,9 +537,9 @@ void OpEmitter::genNamedOperandGetters() {
 }
 
 void OpEmitter::genNamedResultGetters() {
-  const unsigned numResults = op.getNumResults();
-  const unsigned numVariadicResults = op.getNumVariadicResults();
-  const unsigned numNormalResults = numResults - numVariadicResults;
+  const int numResults = op.getNumResults();
+  const int numVariadicResults = op.getNumVariadicResults();
+  const int numNormalResults = numResults - numVariadicResults;
 
   // Special case for ops without variadic results: the i-th value is for the
   // i-th result defined in the op.
@@ -549,7 +549,7 @@ void OpEmitter::genNamedResultGetters() {
   // result.
   if (numVariadicResults <= 1) {
     bool emittedVariadicResult = false;
-    for (unsigned i = 0; i != numResults; ++i) {
+    for (int i = 0; i != numResults; ++i) {
       const auto &result = op.getResult(i);
       if (result.name.empty())
         continue;
@@ -582,17 +582,17 @@ void OpEmitter::genNamedResultGetters() {
                                  "specification over their sizes");
   }
 
-  unsigned emittedNormalResults = 0;
-  unsigned emittedVariadicResults = 0;
+  int emittedNormalResults = 0;
+  int emittedVariadicResults = 0;
 
-  for (unsigned i = 0; i != numResults; ++i) {
+  for (int i = 0; i != numResults; ++i) {
     const auto &result = op.getResult(i);
     if (result.name.empty())
       continue;
 
     const char *code = R"(
-  unsigned variadicResultSize = (this->getNumResults() - {0}) / {1};
-  unsigned offset = {2} + variadicResultSize * {3};
+  int variadicResultSize = (this->getNumResults() - {0}) / {1};
+  int offset = {2} + variadicResultSize * {3};
   return )";
     auto sizeAndOffset = formatv(code, numNormalResults, numVariadicResults,
                                  emittedNormalResults, emittedVariadicResults);
@@ -628,7 +628,7 @@ void OpEmitter::genStandaloneParamBuilder(bool useOperandType,
 
   // Emit parameters for all return types
   if (!useOperandType && !useAttrType) {
-    for (unsigned i = 0; i != numResults; ++i) {
+    for (int i = 0; i != numResults; ++i) {
       const auto &result = op.getResult(i);
       std::string resultName = result.name;
       if (resultName.empty())
@@ -674,7 +674,7 @@ void OpEmitter::genStandaloneParamBuilder(bool useOperandType,
   // Push all result types to the result
   if (numResults > 0) {
     if (!useOperandType && !useAttrType) {
-      for (unsigned i = 0; i < numResults; ++i) {
+      for (int i = 0; i < numResults; ++i) {
         const auto &result = op.getResult(i);
         m.body() << "  " << builderOpState;
         if (result.isVariadic()) {
@@ -699,14 +699,14 @@ void OpEmitter::genStandaloneParamBuilder(bool useOperandType,
             formatv("{0}{1}->getType()", getArgumentName(op, 0), index).str();
       }
       m.body() << "  " << builderOpState << "->addTypes({" << resultType;
-      for (unsigned i = 1; i != numResults; ++i)
+      for (int i = 1; i != numResults; ++i)
         m.body() << ", " << resultType;
       m.body() << "});\n\n";
     }
   }
 
   // Push all operands to the result
-  for (unsigned i = 0; i < numOperands; ++i) {
+  for (int i = 0; i < numOperands; ++i) {
     const auto &operand = op.getOperand(i);
     m.body() << "  " << builderOpState;
     if (operand.isVariadic()) {
@@ -755,13 +755,13 @@ void OpEmitter::genBuilder() {
     }
   }
 
-  unsigned numResults = op.getNumResults();
-  unsigned numVariadicResults = op.getNumVariadicResults();
-  unsigned numNonVariadicResults = numResults - numVariadicResults;
+  int numResults = op.getNumResults();
+  int numVariadicResults = op.getNumVariadicResults();
+  int numNonVariadicResults = numResults - numVariadicResults;
 
-  unsigned numOperands = op.getNumOperands();
-  unsigned numVariadicOperands = op.getNumVariadicOperands();
-  unsigned numNonVariadicOperands = numOperands - numVariadicOperands;
+  int numOperands = op.getNumOperands();
+  int numVariadicOperands = op.getNumVariadicOperands();
+  int numNonVariadicOperands = numOperands - numVariadicOperands;
 
   // Generate default builders that requires all result type, operands, and
   // attributes as parameters.
@@ -955,11 +955,11 @@ void OpEmitter::genVerifier() {
     }
   };
 
-  for (unsigned i = 0, e = op.getNumOperands(); i < e; ++i) {
+  for (int i = 0, e = op.getNumOperands(); i < e; ++i) {
     verifyValue(op.getOperand(i), i, /*isOperand=*/true);
   }
 
-  for (unsigned i = 0, e = op.getNumResults(); i < e; ++i) {
+  for (int i = 0, e = op.getNumResults(); i < e; ++i) {
     verifyValue(op.getResult(i), i, /*isOperand=*/false);
   }
 
@@ -979,8 +979,8 @@ void OpEmitter::genVerifier() {
 }
 
 void OpEmitter::genTraits() {
-  unsigned numResults = op.getNumResults();
-  unsigned numVariadicResults = op.getNumVariadicResults();
+  int numResults = op.getNumResults();
+  int numVariadicResults = op.getNumVariadicResults();
 
   // Add return size trait.
   if (numVariadicResults != 0) {
@@ -1008,8 +1008,8 @@ void OpEmitter::genTraits() {
   }
 
   // Add variadic size trait and normal op traits.
-  unsigned numOperands = op.getNumOperands();
-  unsigned numVariadicOperands = op.getNumVariadicOperands();
+  int numOperands = op.getNumOperands();
+  int numVariadicOperands = op.getNumVariadicOperands();
 
   // Add operand size trait.
   if (numVariadicOperands != 0) {
index 501b7a1..6c0e528 100644 (file)
@@ -420,8 +420,8 @@ void PatternEmitter::emitMatchMethod(DagNode tree) {
         PrintFatalError(loc, "only support up to 4-entity constraints now");
       }
       SmallVector<std::string, 4> names;
-      unsigned i = 0;
-      for (unsigned e = entities.size(); i < e; ++i)
+      int i = 0;
+      for (int e = entities.size(); i < e; ++i)
         names.push_back(resolveSymbol(entities[i]));
       for (; i < 4; ++i)
         names.push_back("<unused>");
@@ -475,7 +475,7 @@ void PatternEmitter::emit(StringRef rewriteName) {
 void PatternEmitter::emitRewriteMethod() {
   const Operator &rootOp = pattern.getSourceRootOp();
   int numExpectedResults = rootOp.getNumResults();
-  unsigned numProvidedResults = pattern.getNumResults();
+  int numProvidedResults = pattern.getNumResults();
 
   if (numProvidedResults < numExpectedResults)
     PrintFatalError(
@@ -490,7 +490,7 @@ void PatternEmitter::emitRewriteMethod() {
 
   // Collect the replacement value for each result
   llvm::SmallVector<std::string, 2> resultValues;
-  for (unsigned i = 0; i < numProvidedResults; ++i) {
+  for (int i = 0; i < numProvidedResults; ++i) {
     DagNode resultTree = pattern.getResultPattern(i);
     resultValues.push_back(handleRewritePattern(resultTree, i, 0));
     // Keep track of bound symbols at the top-level DAG nodes
@@ -595,7 +595,7 @@ std::string PatternEmitter::emitReplaceWithNativeCodeCall(DagNode tree) {
     PrintFatalError(loc, "unsupported NativeCodeCall argument numbers: " +
                              Twine(tree.getNumArgs()));
   }
-  for (unsigned i = 0, e = tree.getNumArgs(); i != e; ++i) {
+  for (int i = 0, e = tree.getNumArgs(); i != e; ++i) {
     attrs[i] = handleOpArgument(tree.getArgAsLeaf(i), tree.getArgName(i));
   }
   return tgfmt(fmt, &rewriteCtx, attrs[0], attrs[1], attrs[2], attrs[3],
@@ -646,7 +646,7 @@ std::string PatternEmitter::emitOpCreate(DagNode tree, int resultIndex,
   // First go through all the child nodes who are nested DAG constructs to
   // create ops for them, so that we can use the results in the current node.
   // This happens in a recursive manner.
-  for (unsigned i = 0, e = resultOp.getNumOperands(); i != e; ++i) {
+  for (int i = 0, e = resultOp.getNumOperands(); i != e; ++i) {
     if (auto child = tree.getArgAsNestedDag(i)) {
       childNodeNames[i] = handleRewritePattern(child, i, depth + 1);
       // Keep track of bound symbols at the middle-level DAG nodes