for (auto en : llvm::enumerate(positionAttr)) {
auto attr = en.value().dyn_cast<IntegerAttr>();
if (!attr || attr.getInt() < 0 ||
- attr.getInt() > op.getVectorType().getDimSize(en.index()))
+ attr.getInt() >= op.getVectorType().getDimSize(en.index()))
return op.emitOpError("expected position attribute #")
<< (en.index() + 1)
<< " to be a non-negative integer smaller than the corresponding "
for (auto en : llvm::enumerate(positionAttr)) {
auto attr = en.value().dyn_cast<IntegerAttr>();
if (!attr || attr.getInt() < 0 ||
- attr.getInt() > destVectorType.getDimSize(en.index()))
+ attr.getInt() >= destVectorType.getDimSize(en.index()))
return op.emitOpError("expected position attribute #")
<< (en.index() + 1)
<< " to be a non-negative integer smaller than the corresponding "
// -----
+func @extract_precise_position_overflow(%arg0: vector<4x8x16xf32>) {
+ // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}}
+ %1 = vector.extract %arg0[3 : i32, 7 : i32, 16 : i32] : vector<4x8x16xf32>
+}
+
+// -----
+
func @extract_position_overflow(%arg0: vector<4x8x16xf32>) {
// expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}}
%1 = vector.extract %arg0[0 : i32, 0 : i32, -1 : i32] : vector<4x8x16xf32>
// -----
+func @insert_precise_position_overflow(%a: f32, %b: vector<4x8x16xf32>) {
+ // expected-error@+1 {{expected position attribute #1 to be a non-negative integer smaller than the corresponding dest vector dimension}}
+ %1 = vector.insert %a, %b[4 : i32, 7 : i32, 15 : i32] : f32 into vector<4x8x16xf32>
+}
+
+// -----
+
func @outerproduct_num_operands(%arg0: f32) {
// expected-error@+1 {{expected at least 2 operands}}
%1 = vector.outerproduct %arg0 : f32, f32