[Mlir-commits] [mlir] [mlir][EmitC] Model lvalues as a type in EmitC (PR #91475)

Gil Rapaport llvmlistbot at llvm.org
Wed Jun 12 00:51:58 PDT 2024


================
@@ -273,6 +276,18 @@ struct CppEmitter {
 };
 } // namespace
 
+/// Determine whether expression \p op should be emitted in a deferred way.
+static bool hasDeferredEmission(Operation *op) {
+  if (isa_and_nonnull<emitc::GetGlobalOp, emitc::LiteralOp, emitc::SubscriptOp>(
+          op))
+    return true;
+
+  if (auto applyOp = dyn_cast_or_null<emitc::ApplyOp>(op))
----------------
aniragil wrote:

IIUC this patch changes the semantics of `emic.apply "*"` from loading the value to having subscript's semantics, i.e. producing to producing an lvalue, breaking existing emitc code by deferring the side effect from the location of the `emitc.apply` op to the location of its user(s).
We can avoid this by adding a new `emitc.dereference` op as suggested [here](https://github.com/llvm/llvm-project/pull/72569) which will start phasing out `emitc.apply` while maintaining its semantics.

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


More information about the Mlir-commits mailing list