[PATCH] D50272: [tablegen] Improve performance of -gen-register-info by replacing barely-necessary std::map with a sorted vector

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 14:33:48 PDT 2018


dsanders created this revision.
dsanders added reviewers: bogner, rtereshin, aditya_nandakumar, volkan.
Herald added subscribers: dexonsmith, mgrang.

This particular map is hardly ever queried and has a phased usage pattern (insert,
iterate, query, insert, iterate) so it's a good candidate for a sorted vector and
std::lower_bound.

This significantly reduces the run time of runTargetDesc() in some circumstances.
One llvm-tblgen invocation in my build improves the time spent in runTargetDesc()
from 9.47s down to 1.10s (~90%) without changing the output. The same invocation
also has 2GB less allocation churn.


Repository:
  rL LLVM

https://reviews.llvm.org/D50272

Files:
  include/llvm/ADT/STLExtras.h
  utils/TableGen/RegisterInfoEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50272.159095.patch
Type: text/x-patch
Size: 5030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/389efa6e/attachment.bin>


More information about the llvm-commits mailing list