[Mlir-commits] [mlir] [mlir][emitc] Support member access for values (PR #203308)

Gil Rapaport llvmlistbot at llvm.org
Sat Jun 13 05:17:45 PDT 2026


================
@@ -1088,6 +1088,25 @@ LogicalResult emitc::LiteralOp::verify() {
     return emitOpError() << "value must not be empty";
   return success();
 }
+
+//===----------------------------------------------------------------------===//
+// MemberOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult MemberOp::verify() {
+  Type operandType = getOperand().getType();
+  Type resultType = getResult().getType();
+  bool resultIsWritable = isa<emitc::LValueType, emitc::ArrayType>(resultType);
+
+  if (isa<emitc::LValueType>(operandType) && !resultIsWritable)
+    return emitOpError("lvalues must return lvalues or arrays");
+
+  if (!isa<emitc::LValueType>(operandType) && resultIsWritable)
+    return emitOpError("non-lvalues cannot return lvalues or arrays");
----------------
aniragil wrote:

This PR implements [my comment](https://github.com/llvm/llvm-project/pull/200659#issuecomment-4586743621) in the 'multi-return as struct' PR.

https://github.com/llvm/llvm-project/pull/203308


More information about the Mlir-commits mailing list