[all-commits] [llvm/llvm-project] c0f210: Don't stash types that aren't copyable or moveable...

Benjamin Kramer via All-commits all-commits at lists.llvm.org
Sat May 2 10:47:03 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c0f210d636300abe891cf7e5f07d13f5f4c0102e
      https://github.com/llvm/llvm-project/commit/c0f210d636300abe891cf7e5f07d13f5f4c0102e
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2020-05-02 (Sat, 02 May 2020)

  Changed paths:
    M clang/lib/Sema/SemaExprCXX.cpp
    M llvm/tools/llvm-exegesis/lib/SnippetGenerator.h

  Log Message:
  -----------
  Don't stash types that aren't copyable or moveable into a SmallVector

This seems to be working by accident.


  Commit: f7bf28b2c02a4785d0d533fbbe4a7d8810b6dcf1
      https://github.com/llvm/llvm-project/commit/f7bf28b2c02a4785d0d533fbbe4a7d8810b6dcf1
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2020-05-02 (Sat, 02 May 2020)

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

  Log Message:
  -----------
  [SmallVector] Weaken the predicate for the memcpy optimization

We don't require the type to be trivially assignable. While the standard
says that only is_trivially_copyable types may be memcpy'd, this seems
overly strict. We never assign the type, so there's no way for the type
to observe that the copy/move construction got elided. This is important
for std::pair<POD, POD>, which is not trivially assignable and probably
never will be because changing that would break ABI.

As a side-effect this no longer allows types with deleted copy/move
constructors in SmallVector. That's an unintended side-effect of
is_trivially_copyable anyways.

Shrinks Release+Asserts clang by 20k.


Compare: https://github.com/llvm/llvm-project/compare/cc1c51655854...f7bf28b2c02a


More information about the All-commits mailing list