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

Matthias Gehre llvmlistbot at llvm.org
Thu May 9 22:42:21 PDT 2024


================
@@ -4,7 +4,8 @@
 func.func @load_store(%arg0: !emitc.array<4x8xf32>, %arg1: !emitc.array<3x5xf32>, %arg2: index, %arg3: index) {
   %0 = emitc.subscript %arg0[%arg2, %arg3] : <4x8xf32>, index, index
   %1 = emitc.subscript %arg1[%arg2, %arg3] : <3x5xf32>, index, index
-  emitc.assign %0 : f32 to %1 : f32
+  %2 = emitc.lvalue_to_rvalue %0 : !emitc.lvalue<f32>
----------------
mgehre-amd wrote:

I'd expect this to generate
```
size_t v4 = v1[v2][v3]; // emitc.lvalue_to_rvalue %0
v0[v2][v3] = v4; // emitc.assign %2 : f32 to %1 
```
If we don't materialize the value of `v4`, reasoning about the memory effects sounds pretty complicated.

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


More information about the Mlir-commits mailing list