[PATCH] D113511: [mlir] Optimize usage of llvm::mapped_iterator

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 9 13:15:47 PST 2021


rriddle created this revision.
rriddle added a reviewer: lattner.
Herald added subscribers: wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, dexonsmith, rdzhabarov, tatianashp, jdoerfert, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, mehdi_amini, bollu.
rriddle requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: MLIR, LLVM.

mapped_iterator is a useful abstraction for applying a
map function over an existing iterator, but our current
usage ends up allocating storage/making indirect calls
even with the map function is a known function, which
is horribly inefficient. This commit refactors the usage
of mapped_iterator to avoid this, and allows for directly
referencing the map function when dereferencing.

Fixes PR52319


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113511

Files:
  llvm/include/llvm/ADT/STLExtras.h
  mlir/include/mlir/IR/BuiltinAttributes.h
  mlir/include/mlir/IR/Diagnostics.h
  mlir/include/mlir/IR/DialectInterface.h
  mlir/include/mlir/IR/TypeRange.h
  mlir/include/mlir/IR/TypeUtilities.h
  mlir/include/mlir/IR/UseDefLists.h
  mlir/lib/IR/BuiltinAttributes.cpp
  mlir/lib/IR/TypeUtilities.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113511.385951.patch
Type: text/x-patch
Size: 17364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/dde46eff/attachment.bin>


More information about the llvm-commits mailing list