File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ static LogicalResult verify(vector::ExtractOp op) {
403
403
for (auto en : llvm::enumerate (positionAttr)) {
404
404
auto attr = en.value ().dyn_cast <IntegerAttr>();
405
405
if (!attr || attr.getInt () < 0 ||
406
- attr.getInt () > op.getVectorType ().getDimSize (en.index ()))
406
+ attr.getInt () >= op.getVectorType ().getDimSize (en.index ()))
407
407
return op.emitOpError (" expected position attribute #" )
408
408
<< (en.index () + 1 )
409
409
<< " to be a non-negative integer smaller than the corresponding "
@@ -517,7 +517,7 @@ static LogicalResult verify(InsertOp op) {
517
517
for (auto en : llvm::enumerate (positionAttr)) {
518
518
auto attr = en.value ().dyn_cast <IntegerAttr>();
519
519
if (!attr || attr.getInt () < 0 ||
520
- attr.getInt () > destVectorType.getDimSize (en.index ()))
520
+ attr.getInt () >= destVectorType.getDimSize (en.index ()))
521
521
return op.emitOpError (" expected position attribute #" )
522
522
<< (en.index () + 1 )
523
523
<< " to be a non-negative integer smaller than the corresponding "
Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ func @extract_position_overflow(%arg0: vector<4x8x16xf32>) {
66
66
67
67
// -----
68
68
69
+ func @extract_precise_position_overflow (%arg0: vector <4 x8 x16 xf32 >) {
70
+ // expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}}
71
+ %1 = vector.extract %arg0 [3 : i32 , 7 : i32 , 16 : i32 ] : vector <4 x8 x16 xf32 >
72
+ }
73
+
74
+ // -----
75
+
69
76
func @extract_position_overflow (%arg0: vector <4 x8 x16 xf32 >) {
70
77
// expected-error@+1 {{expected position attribute #3 to be a non-negative integer smaller than the corresponding vector dimension}}
71
78
%1 = vector.extract %arg0 [0 : i32 , 0 : i32 , -1 : i32 ] : vector <4 x8 x16 xf32 >
@@ -108,6 +115,13 @@ func @insert_position_overflow(%a: f32, %b: vector<4x8x16xf32>) {
108
115
109
116
// -----
110
117
118
+ func @insert_precise_position_overflow (%a: f32 , %b: vector <4 x8 x16 xf32 >) {
119
+ // expected-error@+1 {{expected position attribute #1 to be a non-negative integer smaller than the corresponding dest vector dimension}}
120
+ %1 = vector.insert %a , %b [4 : i32 , 7 : i32 , 15 : i32 ] : f32 into vector <4 x8 x16 xf32 >
121
+ }
122
+
123
+ // -----
124
+
111
125
func @outerproduct_num_operands (%arg0: f32 ) {
112
126
// expected-error@+1 {{expected at least 2 operands}}
113
127
%1 = vector.outerproduct %arg0 : f32 , f32
You can’t perform that action at this time.
0 commit comments