[all-commits] [llvm/llvm-project] 1fb946: [lld-macho] Devirtualize TargetInfo::getRelocAttrs

Daniel Bertalan via All-commits all-commits at lists.llvm.org
Mon Jul 18 10:36:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fb9466c6a4c5805f37cf2ab617d49a20b8a5225
      https://github.com/llvm/llvm-project/commit/1fb9466c6a4c5805f37cf2ab617d49a20b8a5225
  Author: Daniel Bertalan <dani at danielbertalan.dev>
  Date:   2022-07-18 (Mon, 18 Jul 2022)

  Changed paths:
    M lld/MachO/Arch/ARM.cpp
    M lld/MachO/Arch/ARM64.cpp
    M lld/MachO/Arch/ARM64_32.cpp
    M lld/MachO/Arch/X86_64.cpp
    M lld/MachO/Target.h

  Log Message:
  -----------
  [lld-macho] Devirtualize TargetInfo::getRelocAttrs

This method is called on each relocation when parsing input files, so
the overhead of using virtual functions ends up being quite large.  We
now have a single non-virtual method, which reads from the appropriate
array of relocation attributes set in the TargetInfo constructor.

This change results in a modest 2.3% reduction in link time for
chromium_framework measured on an x86-64 VPS, and 0.7% on an arm64 Mac.

    N           Min           Max        Median           Avg        Stddev
x  10     11.869417     12.032609     11.935041     11.938268   0.045802324
+  10     11.581526     11.785265     11.649885     11.659507   0.054634834
Difference at 95.0% confidence
	-0.278761 +/- 0.0473673
	-2.33502% +/- 0.396768%
	(Student's t, pooled s = 0.0504124)

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




More information about the All-commits mailing list