[all-commits] [llvm/llvm-project] f21ead: [C++20] [Modules] [Reduced BMI] Remove unreachable...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Apr 11 22:06:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f21ead06750b670cf8ce72d6666e3550b04056a2
      https://github.com/llvm/llvm-project/commit/f21ead06750b670cf8ce72d6666e3550b04056a2
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-04-12 (Fri, 12 Apr 2024)

  Changed paths:
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/include/clang/Serialization/ASTWriter.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    A clang/test/CXX/module/module.glob.frag/cxx20-10-4-ex2.cppm
    M clang/test/Modules/inconsistent-deduction-guide-linkage.cppm
    M clang/test/Modules/named-modules-adl-2.cppm
    M clang/test/Modules/named-modules-adl.cppm
    M clang/test/Modules/placement-new-reachable.cpp
    M clang/test/Modules/polluted-operator.cppm
    M clang/test/Modules/pr62589.cppm
    M clang/test/Modules/preferred_name.cppm
    M clang/test/Modules/redundant-template-default-arg3.cpp
    M clang/test/Modules/template-function-specialization.cpp

  Log Message:
  -----------
  [C++20] [Modules] [Reduced BMI] Remove unreachable decls GMF in redued BMI (#88359)

Following of https://github.com/llvm/llvm-project/pull/76930

This follows the idea of "only writes what we writes", which I think is
the most natural and efficient way to implement this optimization.

We start writing the BMI from the first declaration in module purview
instead of the global module fragment, so that everything in the GMF
untouched won't be written in the BMI naturally.

The exception is, as I said in
https://github.com/llvm/llvm-project/pull/76930, when we write a
declaration we need to write its decl context, and when we write the
decl context, we need to write everything from it. So when we see
`std::vector`, we basically need to write everything under namespace
std. This violates our intention. To fix this, this patch delays the
writing of namespace in the GMF.

>From my local measurement, the size of the BMI decrease to 90M from 112M
for a local modules build. I think this is significant.

This feature will be covered under the experimental reduced BMI so that
it won't affect any existing users. So I'd like to land this when the CI
gets green.

Documents will be added seperately.



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