[all-commits] [llvm/llvm-project] 0a35cc: [clang][objc] Speed up populating the global metho...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Wed Nov 3 17:11:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a35cc40b881a35c6a7a748f5fdefac4cafc33ce
      https://github.com/llvm/llvm-project/commit/0a35cc40b881a35c6a7a748f5fdefac4cafc33ce
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2021-11-03 (Wed, 03 Nov 2021)

  Changed paths:
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/test/Modules/lookup.m
    A clang/test/Modules/method_pool_transitive.m

  Log Message:
  -----------
  [clang][objc] Speed up populating the global method pool from modules.

For each selector encountered in the source code, we need to load
selectors from the imported modules and check that we are calling a
selector with compatible types.

At the moment, for each module we are storing methods declared in the
headers belonging to this module and methods from the transitive closure
of imported modules. When a module is imported by a few other modules,
methods from the shared module are duplicated in each importer. As the
result, we can end up with lots of identical methods that we try to add
to the global method pool. Doing this duplicate work is useless and
relatively expensive.

Avoid processing duplicate methods by storing in each module only its
own methods and not storing methods from dependencies. Collect methods
from dependencies by walking the graph of module dependencies.

The issue was discovered and reported by Richard Howell. He has done the
hard work for this fix as he has investigated and provided a detailed
explanation of the performance problem.

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




More information about the All-commits mailing list