[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Context-aware type conversions (PR #140434)

Hongren Zheng llvmlistbot at llvm.org
Mon May 19 07:36:19 PDT 2025


ZenithalHourlyRate wrote:

> > Block Return Type (should find Block Terminator, looking "down" in the hierarchy; or should it find parent Block?)

> What is a block return type?

Sorry I was thinking about function return type and my old code used to traverse down to the entry block terminator to get its context. A refactor added a pre-processing to lift that up to the defining op (with ugly annotation to it).

> I'd say that analyzing the defining op of an SSA value is fine. If that is not enough context, you're getting on thin ice.

With that pre-processing, I would agree with it, but by the current state we still need to be careful about BlockArgument. We could add a comment in code that in context-aware conversion hook the only safe IR tarversing is its defining op / parent block but no other access is guaranteed to be safe?

> > ParentOp (like function signature) converted the first or child (like block signature) converted the first will affect whether a Value is able to find its context.

> Is that because once you converted an operation, it can no longer serve as "context"?

I would be curious in one-shot dialect conversion how would a context be defined, if the original IR is not avaiable.

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


More information about the Mlir-commits mailing list