forked from OSchip/llvm-project
Add missing return post parse failure for the indices of a sparse attribute.
PiperOrigin-RevId: 229231462
This commit is contained in:
parent
38c2fe3158
commit
e0594ce732
|
@ -1102,6 +1102,8 @@ Attribute Parser::parseAttribute(Type type) {
|
||||||
auto indicesEltType = builder.getIntegerType(32);
|
auto indicesEltType = builder.getIntegerType(32);
|
||||||
auto indices =
|
auto indices =
|
||||||
parseDenseElementsAttr(indicesEltType, type.isa<VectorType>());
|
parseDenseElementsAttr(indicesEltType, type.isa<VectorType>());
|
||||||
|
if (!indices)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if (parseToken(Token::comma, "expected ','"))
|
if (parseToken(Token::comma, "expected ','"))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -867,3 +867,9 @@ func @mi() {
|
||||||
func @invalid_tensor_literal() {
|
func @invalid_tensor_literal() {
|
||||||
// expected-error @+1 {{expected '[' in tensor literal list}}
|
// expected-error @+1 {{expected '[' in tensor literal list}}
|
||||||
"foof16"(){bar: sparse<vector<1x1x1xf16>, [[0, 0, 0]], -2.0]>} : () -> ()
|
"foof16"(){bar: sparse<vector<1x1x1xf16>, [[0, 0, 0]], -2.0]>} : () -> ()
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
func @invalid_tensor_literal() {
|
||||||
|
// expected-error @+1 {{expected '[' or scalar constant inside tensor literal}}
|
||||||
|
"fooi16"(){bar: sparse<tensor<2x2x2xi16>, [[1, 1, 0], [0, 1, 0], [0,, [[0, 0, 0]], [-2.0]>} : () -> ()
|
||||||
|
|
Loading…
Reference in New Issue