[all-commits] [llvm/llvm-project] e04fc2: [llvm][lldb] Remove unused SmallVectorMemoryBuffer...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Dec 9 02:32:27 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e04fc2d88efa60ed5527b90c15d8fc188739e989
      https://github.com/llvm/llvm-project/commit/e04fc2d88efa60ed5527b90c15d8fc188739e989
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M lldb/unittests/Expression/CppModuleConfigurationTest.cpp
    M llvm/lib/LTO/LTOBackend.cpp
    M llvm/lib/Object/MachOUniversalWriter.cpp

  Log Message:
  -----------
  [llvm][lldb] Remove unused SmallVectorMemoryBuffer.h includes


  Commit: d0262c2394f46bb7da2a75529413d625c70908e5
      https://github.com/llvm/llvm-project/commit/d0262c2394f46bb7da2a75529413d625c70908e5
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M clang/unittests/AST/ASTImporterTest.cpp
    M clang/unittests/Frontend/TextDiagnosticTest.cpp
    M llvm/include/llvm/Support/SmallVectorMemoryBuffer.h
    M llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
    M llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
    M llvm/lib/LTO/ThinLTOCodeGenerator.cpp
    M llvm/lib/Object/ArchiveWriter.cpp
    M llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
    M llvm/tools/llvm-objcopy/llvm-objcopy.cpp
    M llvm/unittests/Support/MemoryBufferTest.cpp

  Log Message:
  -----------
  [llvm] Add null-termination capability to SmallVectorMemoryBuffer

Most of `MemoryBuffer` interfaces expose a `RequiresNullTerminator` parameter that's being used to:
* determine how to open a file (`mmap` vs `open`),
* assert newly initialized buffer indeed has an implicit null terminator.

This patch adds the paramater to the `SmallVectorMemoryBuffer` constructors, meaning:
* null terminator can now be added to `SmallVector`s that didn't have one before,
* `SmallVectors` that had a null terminator before keep it even after the move.

In line with existing code, the new parameter is defaulted to `true`. This patch makes sure all calls to the `SmallVectorMemoryBuffer` constructor set it to `false` to preserve the current semantics.

Reviewed By: dexonsmith

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


  Commit: 13a351e862ba3f443b31fac57863625a5c43e43b
      https://github.com/llvm/llvm-project/commit/13a351e862ba3f443b31fac57863625a5c43e43b
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
    M clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp

  Log Message:
  -----------
  [clang][deps] Use MemoryBuffer in minimizing FS

This patch avoids unnecessarily copying contents of `mmap`-ed files into `CachedFileSystemEntry` by storing `MemoryBuffer` instead. The change leads to ~50% reduction of peak memory footprint when scanning LLVM+Clang via `clang-scan-deps`.

Depends on D115331.

Reviewed By: dexonsmith

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


Compare: https://github.com/llvm/llvm-project/compare/45ea542dd822...13a351e862ba


More information about the All-commits mailing list