[all-commits] [llvm/llvm-project] bbe463: [OptTable] Make ValuesCode initialisation of Optio...

serge-sans-paille via All-commits all-commits at lists.llvm.org
Thu Jan 12 03:08:28 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbe463d6ba268a2bfc45d539314b70cfd72d2360
      https://github.com/llvm/llvm-project/commit/bbe463d6ba268a2bfc45d539314b70cfd72d2360
  Author: serge-sans-paille <sguelton at mozilla.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/DriverOptions.cpp
    M llvm/include/llvm/Option/OptTable.h
    M llvm/lib/Option/OptTable.cpp
    M llvm/utils/TableGen/OptParserEmitter.cpp

  Log Message:
  -----------
  [OptTable] Make ValuesCode initialisation of Options constexpr

Current implementation requires a copy of the initialization array to a
vector to be able to modify their Values field.

This is inefficient: it requires a large copy to update a value, while
TableGen has all information to avoid this overwrite.

Modify TableGen to emit the Values code and use it to perform the
initialisation.

The impact on performance is not amazing compared to the actual
compilation, but still noticeable:

https://llvm-compile-time-tracker.com/compare.php?from=d9ab3e82f30d646deff054230b0c742704a1cf26&to=f2b37fb65d5149f70b43d1801beb5239285a2a20&stat=instructions:u

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


  Commit: 07bb29d8ffc3b82d5a7bb1217d93e8fa86e6969a
      https://github.com/llvm/llvm-project/commit/07bb29d8ffc3b82d5a7bb1217d93e8fa86e6969a
  Author: serge-sans-paille <sguelton at mozilla.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M clang/lib/Driver/DriverOptions.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
    M lld/COFF/Driver.h
    M lld/COFF/DriverUtils.cpp
    M lld/ELF/Driver.h
    M lld/ELF/DriverUtils.cpp
    M lld/MachO/Driver.h
    M lld/MachO/DriverUtils.cpp
    M lld/MinGW/Driver.cpp
    M lld/wasm/Driver.cpp
    M lldb/tools/driver/Driver.cpp
    M lldb/tools/lldb-server/lldb-gdbserver.cpp
    M lldb/tools/lldb-vscode/lldb-vscode.cpp
    M llvm/include/llvm/Option/OptTable.h
    M llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
    M llvm/lib/Option/OptTable.cpp
    M llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
    M llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
    M llvm/tools/dsymutil/dsymutil.cpp
    M llvm/tools/llvm-cvtres/llvm-cvtres.cpp
    M llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
    M llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
    M llvm/tools/llvm-ifs/llvm-ifs.cpp
    M llvm/tools/llvm-lipo/llvm-lipo.cpp
    M llvm/tools/llvm-ml/llvm-ml.cpp
    M llvm/tools/llvm-mt/llvm-mt.cpp
    M llvm/tools/llvm-nm/llvm-nm.cpp
    M llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
    M llvm/tools/llvm-objdump/llvm-objdump.cpp
    M llvm/tools/llvm-rc/llvm-rc.cpp
    M llvm/tools/llvm-readobj/llvm-readobj.cpp
    M llvm/tools/llvm-size/llvm-size.cpp
    M llvm/tools/llvm-strings/llvm-strings.cpp
    M llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
    M llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
    M llvm/unittests/Option/OptionParsingTest.cpp
    M llvm/utils/TableGen/OptParserEmitter.cpp

  Log Message:
  -----------
  [OptTable] Precompute OptTable prefixes union table through tablegen

This avoid rediscovering this table when reading each options, providing
a sensible 2% speedup when processing and empty file, and a measurable
speedup on typical workloads, see:

This is optional, the legacy, on-the-fly, approach can still be used
through the GenericOptTable class, while the new one is used through
PrecomputedOptTable.

https://llvm-compile-time-tracker.com/compare.php?from=4da6cb3202817ee2897d6b690e4af950459caea4&to=19a492b704e8f5c1dea120b9c0d3859bd78796be&stat=instructions:u

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


Compare: https://github.com/llvm/llvm-project/compare/87e547d8f035...07bb29d8ffc3


More information about the All-commits mailing list