[all-commits] [llvm/llvm-project] fef16a: [mlir][ODS] Fix notorious double-space bug in op p...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Fri Mar 6 13:32:23 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fef16a71d3fa9c2ec63233a63d124f10e2c8ba91
      https://github.com/llvm/llvm-project/commit/fef16a71d3fa9c2ec63233a63d124f10e2c8ba91
  Author: Jakub Kuderski <jakub at nod-labs.com>
  Date:   2026-03-06 (Fri, 06 Mar 2026)

  Changed paths:
    M flang/test/Lower/location.f90
    M mlir/include/mlir/Dialect/Index/IR/IndexOps.td
    M mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td
    M mlir/test/CAPI/irdl.c
    M mlir/test/Dialect/GPU/shuffle-rewrite.mlir
    M mlir/test/Dialect/GPU/sparse-roundtrip.mlir
    M mlir/test/Dialect/SparseTensor/GPU/gpu_spgemm_lib.mlir
    M mlir/test/Dialect/Vector/vector-warp-distribute.mlir
    M mlir/test/Dialect/XeGPU/sg-to-wi-experimental-unit.mlir
    M mlir/test/IR/array-of-attr.mlir
    M mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir
    M mlir/test/mlir-tblgen/attr-or-type-format.td
    M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
    M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp

  Log Message:
  -----------
  [mlir][ODS] Fix notorious double-space bug in op printers (#184253)

When an op's assembly format prints an attribute via
`printStrippedAttrOrType`, two independent space-emission mechanisms
would fire: the op format generator emits a space before each argument,
and the attribute's generated `print` method also emits a leading space
(`shouldEmitSpace` initialized to true). This caused double spaces like
`gpu.shuffle xor`.

The usual workaround for this was to add double backticks to consume the
leading space.

Fixed by removing the leading space from generated attr/type `print()`
methods and compensating in the print dispatcher by conditionally adding
a space between the mnemonic and `print` call when the format starts
with a name or keyword rather than punctuation.

Also remove some workarounds for the double-spacing in op formats and
fix tests that now don't have leading spaces.

Assisted-by: claude



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