[all-commits] [llvm/llvm-project] fef356: [mlir] Pass Options ownership modifications (#110582)

Nikhil Kalra via All-commits all-commits at lists.llvm.org
Tue Oct 1 09:49:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fef3566a25ff0e34fb87339ba5e13eca17cec00f
      https://github.com/llvm/llvm-project/commit/fef3566a25ff0e34fb87339ba5e13eca17cec00f
  Author: Nikhil Kalra <nkalra at apple.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M mlir/include/mlir/Transforms/Passes.h
    M mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
    M mlir/tools/mlir-tblgen/PassGen.cpp
    M mlir/unittests/TableGen/PassGenTest.cpp

  Log Message:
  -----------
  [mlir] Pass Options ownership modifications (#110582)

This change makes two (related) changes: 

First, it updates the tablegen option for `ListOption` to emit a
`SmallVector` instead of an `ArrayRef`. This brings `ListOption` more
inline with the traditional `Option`, where values are typically
provided using types that have storage. After this change, all options
should be fully owned by a Pass' `Options` object after it has been
fully constructed, unless the underlying type of the `Option` explicitly
indicates otherwise.

Second, it updates the generated constructors for Passes to consume
options by value instead of reference, and prefers moving options into
the pass itself. This should be more efficient for non-trivial options
objects, where the previous interface forced a copy to be materialized.
Now, at worst case the API materializes a copy (no worse than before);
at best-case, all options objects are moved into place. Ideally, we
could update the Pass constructor to take an r-value reference to the
Options object instead, but this approach will require numerous changes
to existing passes and their factory functions.

---------

Authored-by: Nikhil Kalra <nkalra at apple.com>



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