Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mlir/lib/Dialect/EmitC/IR/EmitC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,11 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {

// global has non-array type
auto lvalueType = dyn_cast<LValueType>(resultType);
if (!lvalueType || lvalueType.getValueType() != globalType)
if (!lvalueType)
return emitOpError("on non-array type expects result type to be an "
"lvalue type for the global @")
<< getName();
if (lvalueType.getValueType() != globalType)
return emitOpError("on non-array type expects result inner type ")
<< lvalueType.getValueType() << " to match type " << globalType
<< " of the global @" << getName();
Expand Down
10 changes: 10 additions & 0 deletions mlir/test/Dialect/EmitC/invalid_ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,16 @@ func.func @use_global() {

// -----

emitc.global @myglobal_value : f32

func.func @use_global() {
// expected-error @+1 {{'emitc.get_global' op on non-array type expects result type to be an lvalue type for the global @myglobal_value}}
%0 = emitc.get_global @myglobal_value : !emitc.array<2xf32>
return
}

// -----

func.func @member(%arg0: !emitc.lvalue<i32>) {
// expected-error @+1 {{'emitc.member' op operand #0 must be emitc.lvalue of EmitC opaque type values, but got '!emitc.lvalue<i32>'}}
%0 = "emitc.member" (%arg0) {member = "a"} : (!emitc.lvalue<i32>) -> !emitc.lvalue<i32>
Expand Down