[all-commits] [llvm/llvm-project] 7ff3a8: [clang][NFC] Add IsAnyDestructorNoReturn field to ...

zero9178 via All-commits all-commits at lists.llvm.org
Sun Jun 13 05:48:45 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ff3a89a7b94193638cb13f8a0a1ef70094c8263
      https://github.com/llvm/llvm-project/commit/7ff3a89a7b94193638cb13f8a0a1ef70094c8263
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2021-06-13 (Sun, 13 Jun 2021)

  Changed paths:
    M clang/include/clang/AST/CXXRecordDeclDefinitionBits.def
    M clang/include/clang/AST/DeclCXX.h
    M clang/lib/AST/DeclCXX.cpp

  Log Message:
  -----------
  [clang][NFC] Add IsAnyDestructorNoReturn field to CXXRecord instead of calculating it on demand

This patch addresses a performance issue I noticed when using clang-12 to compile projects of mine. Even though the files weren't too large (around 1k cpp), the compiler was taking more than a minute to compile the source file, much longer than either GCC or MSVC.

Using a profiler it turned out the issue was the isAnyDestructorNoReturn function in CXXRecordDecl. In particular it being recursive, recalculating the property for every invocation, for every field and base class. This showed up in tracebacks in the profiler.

This patch instead adds IsAnyDestructorNoReturn as a Field to the data inside of CXXRecord and updates when a new base class, destructor, or record field member is added.

After this patch the problematic file of mine went from a compile time of 81s, down to 12s.

The patch itself should not change any functionality, just improve performance.

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




More information about the All-commits mailing list