[all-commits] [llvm/llvm-project] 9554aa: [Dwarf] Optimize getOrCreateSourceID() for repeate...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 25 00:30:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9554aaa2753bd866a00bf6fb4183656200e758e2
      https://github.com/llvm/llvm-project/commit/9554aaa2753bd866a00bf6fb4183656200e758e2
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-25 (Tue, 25 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

  Log Message:
  -----------
  [Dwarf] Optimize getOrCreateSourceID() for repeated calls on same file (NFCI)

DwarfCompileUnit::getOrCreateSourceID() is often called many times
in sequence with the same DIFile. This is currently very expensive,
because it involves creating a string from directory and file name
and looking it up in a string map. This patch remembers the last
DIFile and its ID and directly returns that.

This gives a geomean -1.3% compile-time improvement on CTMark O0-g.

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




More information about the All-commits mailing list