[all-commits] [llvm/llvm-project] c3c123: [mlir][NFC] Migrate to OpAsmAttrInterface for some...

Hongren Zheng via All-commits all-commits at lists.llvm.org
Wed Mar 5 09:20:36 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c3c1230e731af9e989c4235e451d3d4b35adc512
      https://github.com/llvm/llvm-project/commit/c3c1230e731af9e989c4235e451d3d4b35adc512
  Author: Hongren Zheng <i at zenithal.me>
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
    M mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/include/mlir/IR/BuiltinTypeInterfaces.h
    M mlir/include/mlir/IR/OpAsmInterface.td
    A mlir/include/mlir/IR/OpAsmSupport.h
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/IR/BuiltinDialect.cpp

  Log Message:
  -----------
  [mlir][NFC] Migrate to OpAsmAttrInterface for some Builtin Attributes for alias (#128191)

After the introduction of `OpAsmAttrInterface` for alias in #124721, the
natural thought to exercise it would be migrating the MLIR existing
alias generation method, i.e. `OpAsmDialectInterface`, to use the new
interface.

There is a `BuiltinOpAsmDialectInterface` that generates aliases for
`AffineMapAttr` and `IntegerSetAttr`, and these attributes could be
migrated to use `OpAsmAttrInterface`.

However, the tricky part is that `OpAsmAttrInterface` lives in
`OpImplementation.h`. If `BuiltinAttributes.h` includes that, it would
become a cyclic inclusion.

Note that only BuiltinAttribute/Type would face such issue as outside
user can just include `OpImplementation.h` (see downstream example
https://github.com/google/heir/pull/1437)

The dependency is introduced by the fact that `OpAsmAttrInterface` uses
`OpAsmDialectInterface::AliasResult`.

The solution to is: Put the `AliasResult` in `OpAsmSupport.h` that all
interfaces can include that header safely. The API wont break as
`mlir::OpAsmDialectInterface::AliasResult` is a typedef of this class.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list