[all-commits] [llvm/llvm-project] f5b974: [mlir][sparse] Adding `{Var, DimLvlExpr, DimSpec, Lvl...

wren romano via All-commits all-commits at lists.llvm.org
Tue Aug 22 20:31:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f5b974b7835a27de7c5d6142e935f2f95da997a3
      https://github.com/llvm/llvm-project/commit/f5b974b7835a27de7c5d6142e935f2f95da997a3
  Author: wren romano <2998727+wrengr at users.noreply.github.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.cpp
    M mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMap.h
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.cpp
    M mlir/lib/Dialect/SparseTensor/IR/Detail/Var.h

  Log Message:
  -----------
  [mlir][sparse] Adding `{Var,DimLvlExpr,DimSpec,LvlSpec,DimLvlMap}::str` methods

These methods are needed for use with `Diagnostic::operator<<` etc.

The definitions follow the pattern of `Diagnostic::str` by simply wrapping the underlying `print(raw_ostream)` method.  Although there is some overhead for constructing the `std::string`, this seems like the overall most-efficient option: since this overhead only occurs on the error path (under the current intended usage).  An alternative approach would be to have one method construct a `Twine` directly, and then have the print method pass the twine to the stream; however, that would mean introducing the overhead of twine construction on the common/happy path of simply printing things out.

Reviewed By: aartbik

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




More information about the All-commits mailing list