[all-commits] [llvm/llvm-project] 991154: [LTO] Use .at instead of .lookup to avoid copies. ...

Krzysztof Pszeniczny via All-commits all-commits at lists.llvm.org
Wed Nov 27 09:41:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 991154d0fbc951e2b999589a95dabc7deff7acd1
      https://github.com/llvm/llvm-project/commit/991154d0fbc951e2b999589a95dabc7deff7acd1
  Author: Krzysztof Pszeniczny <kpszeniczny at google.com>
  Date:   2024-11-27 (Wed, 27 Nov 2024)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionImport.cpp

  Log Message:
  -----------
  [LTO] Use .at instead of .lookup to avoid copies. (NFC) (#117888)

`DenseMap::lookup` returns by value (because it default-creates the
returned value if the key isn't present in the map), which means that we
do a lot of copying here. Since we assert that something is present in
the returned value two lines below this call, it's safe to use `.at`
here instead.

Copying and then destroying dense maps here is responsible for 60% of
the time spent in LTO indexing in a large internal build.



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