[all-commits] [llvm/llvm-project] 897f3d: [Sema] Move Diags.isIgnored() checks off hot paths...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Sep 7 07:18:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 897f3ddc6154fee9bc072f800ceab8202b236b0a
      https://github.com/llvm/llvm-project/commit/897f3ddc6154fee9bc072f800ceab8202b236b0a
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-09-07 (Wed, 07 Sep 2022)

  Changed paths:
    M clang/lib/Sema/Sema.cpp

  Log Message:
  -----------
  [Sema] Move Diags.isIgnored() checks off hot paths, it's not free. NFC

This speeds up clangd's buildAST() (i.e. parsing with a preamble) by 5% on
clangd/AST.cpp, by avoiding filling up the diagnostic state map with entries for
all the files where templates are being instantiated from.

(I would assume it has a similar effect on PCH and modules compiles).

This approach is obviously pretty fragile, and we should find ways to make
isIgnored() cheaper instead. But these changes in particular don't seem to make
the code worse in any case.

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




More information about the All-commits mailing list