[all-commits] [llvm/llvm-project] 285cf9: [IR] Move global_objects and global_values out of ...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Fri Nov 22 19:28:16 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 285cf9a84e1bd2f601b097fc29f75ea4c7779eba
      https://github.com/llvm/llvm-project/commit/285cf9a84e1bd2f601b097fc29f75ea4c7779eba
  Author: Reid Kleckner <rnk at google.com>
  Date:   2019-11-22 (Fri, 22 Nov 2019)

  Changed paths:
    M llvm/include/llvm/IR/Module.h
    M llvm/lib/IR/Module.cpp

  Log Message:
  -----------
  [IR] Move global_objects and global_values out of line, NFC

This saves 2.4% of CPU time compiling opt, according to
ClangBuildAnalyzer. These helpers being inlined in the header was
triggering the instantiation of concat_iterator in every TU using
Module.h (~1118 TUs): https://reviews.llvm.org/P8171$35

**** Templates that took longest to instantiate:
 76187 ms: llvm::AnalysisManager<llvm::Function>::getResult<llvm::TargetLibrary... (396 times, avg 192 ms)
 73609 ms: llvm::AnalysisManager<llvm::Function>::getResultImpl (420 times, avg 175 ms)
 49657 ms: llvm::detail::concat_range<llvm::GlobalValue, llvm::iterator_range<l... (1118 times, avg 44 ms)
 49376 ms: llvm::detail::concat_range<const llvm::GlobalValue, llvm::iterator_r... (1118 times, avg 44 ms)
 48167 ms: llvm::iterator_range<llvm::concat_iterator<llvm::GlobalValue, llvm::... (1118 times, avg 43 ms)
 48125 ms: llvm::iterator_range<llvm::concat_iterator<const llvm::GlobalValue, ... (1118 times, avg 43 ms)
 48061 ms: llvm::concat_iterator<llvm::GlobalValue, llvm::ilist_iterator<llvm::... (1118 times, avg 42 ms)
 48014 ms: llvm::concat_iterator<const llvm::GlobalValue, llvm::ilist_iterator<... (1118 times, avg 42 ms)
...

I haven't measured, but I don't think these helpers are performance
critical.  The iterator advance call can still be inlined, which is what
matters for performance.

Remove global_(objects|values)_(begin|end), since they were dead and
would have to be out of line anyway.




More information about the All-commits mailing list