[all-commits] [llvm/llvm-project] 264aaa: [mlir][ods] Optimize FoldAdaptor constructor (#93219)

Jeff Niu via All-commits all-commits at lists.llvm.org
Thu May 23 10:50:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 264aaa5f9038a7e575b3aa1ae67bceabd65ee13a
      https://github.com/llvm/llvm-project/commit/264aaa5f9038a7e575b3aa1ae67bceabd65ee13a
  Author: Jeff Niu <jeff at modular.com>
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
    M mlir/test/mlir-tblgen/op-decl-and-defs.td
    M mlir/test/mlir-tblgen/op-operand.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir][ods] Optimize FoldAdaptor constructor (#93219)

FoldAdaptor is generated as a subclass of the operation's generic
adaptor, which requires an OperationName instance. It called into the
generic base constructor that constructed the OperationName from a
string, requiring a StringMap lookup inside the MLIRContext.

This makes constructing FoldAdaptors really slow, which is a shame
because the `Operation *` is right there. This PR changes GenericAdaptor
constructor from an operation to grab the OperationName directly from
the `Operation *`. In addition, it generates the constructor inline if
the operation doesn't have properties, since otherwise it requires the
definition of the op.



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