[all-commits] [llvm/llvm-project] f6ee19: [mlir][ods] Do not print default-valued attributes...

Jeremy Furtek via All-commits all-commits at lists.llvm.org
Mon Oct 17 13:59:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6ee194b68e0731f29d7217749f75769e95947ac
      https://github.com/llvm/llvm-project/commit/f6ee194b68e0731f29d7217749f75769e95947ac
  Author: Jeremy Furtek <jfurtek at nvidia.com>
  Date:   2022-10-17 (Mon, 17 Oct 2022)

  Changed paths:
    M mlir/docs/OpDefinitions.md
    M mlir/test/Dialect/AMDGPU/ops.mlir
    M mlir/test/IR/attribute.mlir
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/python/dialects/transform_loop_ext.py
    M mlir/test/python/dialects/transform_structured_ext.py
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][ods] Do not print default-valued attributes when the value is equal to the default

This diff causes the `tblgen`-erated print() function to skip printing a
`DefaultValuedAttr` attribute when the value is equal to the default.

This feature will reduce the amount of custom printing code that needs to be
written by users a relatively common scenario. As a motivating example, for the
fastmath flags in the LLVMIR dialect, we would prefer to print this:

```
%0 = llvm.fadd %arg0, %arg1 : f32
```

instead of this:

```
%0 = llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath<none>} : f32
```

This diff makes the handling of print functionality for default-valued attributes
standard.

This is an updated version of https://reviews.llvm.org/D135398, without the per-attribute bit to control printing.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D135993




More information about the All-commits mailing list