[all-commits] [llvm/llvm-project] 9a1d14: [LTO] Don't make unnecessary copies of ImportIDTab...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Mon Sep 2 18:41:08 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a1d14a8d26778a5d2d24928ba11cc557c2df24b
      https://github.com/llvm/llvm-project/commit/9a1d14a8d26778a5d2d24928ba11cc557c2df24b
  Author: Kazu Hirata <kazu at google.com>
  Date:   2024-09-02 (Mon, 02 Sep 2024)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/FunctionImport.h

  Log Message:
  -----------
  [LTO] Don't make unnecessary copies of ImportIDTable (#106998)

Without this patch, {ImportMapTy,SortedImportList}::{begin,end} make
unnecessary copies of ImportIDTable via:

  map_iterator(Imports.begin(), IDs);

The second parameter, IDs, is passed by value, so we make a copy of
MapVector inside ImportIDTable every time we call begin and end.
These begin and end show up as time-consuming functions in the
performance profile.

This patch fixes the problem by passing IDs by reference with
std::cref.

While we are at it, this patch deletes the copy constructor and
assignment operator.  I cannot think of any legitimate need reason to
make a copy of the deduplication table.



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