ExtractElementsOp asserts for >1 operator however it actually expects
authorRob Suderman <suderman@google.com>
Tue, 30 Apr 2019 16:52:38 +0000 (09:52 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 6 May 2019 15:22:30 +0000 (08:22 -0700)
    >0 operators.

--

PiperOrigin-RevId: 245966586

mlir/lib/StandardOps/Ops.cpp

index ab600bd..3aa35cd 100644 (file)
@@ -1546,7 +1546,7 @@ LogicalResult ExtractElementOp::verify() {
 
 Attribute ExtractElementOp::constantFold(ArrayRef<Attribute> operands,
                                          MLIRContext *context) {
-  assert(operands.size() > 1 && "extract_element takes atleast one operands");
+  assert(!operands.empty() && "extract_element takes atleast one operand");
 
   // The aggregate operand must be a known constant.
   Attribute aggregate = operands.front();