Skip to content

[P0] Function signatures remain typed returns while bodies are lowered to (ptr,len) return protocol #18

@ngmachado

Description

@ngmachado

Problem

ConvertFuncOp intends to rewrite non-void function result types to (sir.ptr<1>, sir.u256), but in final conversion target func.func is legal and signatures remain as old scalar returns (i8, i256) while bodies emit sir.return ptr,len/sir.iret conventions.

Expected

Function type signatures and return op conventions must be consistent.

Actual

Mixed calling conventions coexist in emitted IR.

Evidence

  • Conversion logic: src/mlir/ora/lowering/OraToSIR/patterns/ControlFlow.cpp:378
  • Conversion logic: src/mlir/ora/lowering/OraToSIR/patterns/ControlFlow.cpp:387
  • Phase 4 legality keeps func op legal: src/mlir/ora/lowering/OraToSIR/OraToSIR.cpp:1333
  • Repro shows function signature -> i8 with memory-return body.

Impact

ABI/call lowering fragility and pass-order sensitivity.

Acceptance Criteria

  • For non-void lowered functions, signatures are consistently rewritten to the return convention used in bodies.
  • sir.icall result typing and callee signatures match without legalizer repair hacks.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions