llvm / llvm/llvm-project

[EmitC] [203455] Inconsistent handling of emitc.lvalue function arguments between mlir-opt and mlir-translate

Open
#203,668 0 comments 0 reactions 0 assignees View on GitHub
mlir:emitc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

mlir-opt accepts func.func arguments of type !emitc.lvalue<...>, but mlir-translate --mlir-to-cpp rejects the same IR.

Reproducer

```mlir
func.func @member_access(
%arg0: !emitc.lvalue>) {

%0 = "emitc.member"(%arg0) {member = "a"}
: (!emitc.lvalue>)
-> !emitc.lvalue

return
}
```

Commands

`mlir-opt test.mlir`

succeeds.

`mlir-translate --mlir-to-cpp test.mlir`

fails with

`error: 'func.func' op cannot emit lvalue type as argument type`

Expected behavior

Either

func.func verification should reject !emitc.lvalue argument types, making mlir-opt consistent with the translator,

or

the C++ translator should support emitting !emitc.lvalue function arguments.

Contributor guide

Open the contributing guide

Research direction

Run the supplied reproducer with mlir-opt and mlir-translate --mlir-to-cpp, then trace how EmitC lvalue function arguments are verified and translated at those entry points. Done when the selected behavior is implemented and both commands handle the reproducer consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.