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

Gil Rapaport llvmlistbot at llvm.org
Thu Jun 13 07:57:08 PDT 2024


================
@@ -234,26 +225,26 @@ func.func @test_misplaced_yield() {
 
 // -----
 
-func.func @test_assign_to_non_variable(%arg1: f32, %arg2: f32) {
-  // expected-error @+1 {{'emitc.assign' op requires first operand (<block argument> of type 'f32' at index: 1) to be a Variable or subscript}}
-  emitc.assign %arg1 : f32 to %arg2 : f32
+func.func @test_assign_to_non_variable(%arg1: f32, %arg2: !emitc.lvalue<f32>) {
+  // expected-error @+1 {{'emitc.assign' op cannot assign to block argument}}
+  emitc.assign %arg1 : f32 to %arg2 : !emitc.lvalue<f32>
----------------
aniragil wrote:

> I think it would be consistent to translate lvalue arguments into reference arguments in C++

Translating into a C++ reference indeed sounds like a 1-1 translation of an lvalue argument. But if so, it should support both address taking and assignment into as any other lvalue, right?

> but we can also forbid it for now to keep the scope of the PR smaller

I'm ok with that option too, as IINM we don't have any lowering that could generate lvalue arguments ATM anyway. @simon-camp, would you prefer to block it for now or fully support it?

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


More information about the Mlir-commits mailing list