Use hasRank instead of comparing rank to -1
authorGeoffrey Martin-Noble <gcmn@google.com>
Thu, 30 May 2019 00:15:51 +0000 (17:15 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:10:03 +0000 (20:10 -0700)
--

PiperOrigin-RevId: 250598252

mlir/lib/StandardOps/Ops.cpp

index 94f5a67..66a1226 100644 (file)
@@ -1600,8 +1600,8 @@ static LogicalResult verify(ExtractElementOp op) {
       return op.emitOpError("index to extract_element must have 'index' type");
 
   // Verify the # indices match if we have a ranked type.
-  auto aggregateRank = aggregateType.getRank();
-  if (aggregateRank != -1 && aggregateRank != op.getNumOperands() - 1)
+  if (aggregateType.hasRank() &&
+      aggregateType.getRank() != op.getNumOperands() - 1)
     return op.emitOpError("incorrect number of indices for extract_element");
 
   return success();