[all-commits] [llvm/llvm-project] b9c2dd: [ADT] Specialize std::swap() for SetVector

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jul 13 14:14:26 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b9c2dd11a5139b754afca050effac80f3b638bc8
      https://github.com/llvm/llvm-project/commit/b9c2dd11a5139b754afca050effac80f3b638bc8
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-07-13 (Mon, 13 Jul 2020)

  Changed paths:
    M llvm/include/llvm/ADT/SetVector.h

  Log Message:
  -----------
  [ADT] Specialize std::swap() for SetVector

This is intended to address a compile-time regression from
1eddce4177cfddc86d4696b758904443b0b4f193. A SmallPtrSet was
replaced with a SetVector there, which had an unexpected large
compile-time impact. It turns out that this structure is getting
swapped a lot, and previously this used an optimized std::swap()
specialization for SmallPtrSet. Now it ends up using the default,
triple-move based implementation, which is much more expensive.

This patch (partly) addresses the issue by specializing std::swap()
for SetVector.

Differential Revision: https://reviews.llvm.org/D82230




More information about the All-commits mailing list