Skip to content

Commit e8dd5e3

Browse files
committed
Update error message and add test file
1 parent 2a56a5d commit e8dd5e3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ LogicalResult cir::ShiftOp::verify() {
14331433
return emitOpError() << "input types cannot be one vector and one scalar";
14341434

14351435
if (isOp1Vec && !mlir::isa<cir::VectorType>(getResult().getType())) {
1436-
return emitOpError() << "shift amount must have the type of the result "
1436+
return emitOpError() << "the type of the result must be a vector "
14371437
<< "if it is vector shift";
14381438
}
14391439
return mlir::success();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: cir-opt %s -verify-diagnostics -split-input-file
2+
3+
!s32i = !cir.int<s, 32>
4+
5+
module {
6+
cir.func @foo() {
7+
%1 = cir.const #cir.int<1> : !s32i
8+
%2 = cir.const #cir.int<2> : !s32i
9+
%3 = cir.const #cir.int<3> : !s32i
10+
%4 = cir.const #cir.int<4> : !s32i
11+
%5 = cir.vec.create(%1, %2, %3, %4 : !s32i, !s32i, !s32i, !s32i) : !cir.vector<4 x !s32i>
12+
%6 = cir.vec.create(%1, %2, %3, %4 : !s32i, !s32i, !s32i, !s32i) : !cir.vector<4 x !s32i>
13+
// expected-error @below {{the type of the result must be a vector if it is vector shift}}
14+
%7 = cir.shift(left, %5 : !cir.vector<4 x !s32i>, %6 : !cir.vector<4 x !s32i>) -> !s32i
15+
cir.return
16+
}
17+
}

0 commit comments

Comments
 (0)