[OptTable] Make ValuesCode initialisation of Options constexpr
authorserge-sans-paille <sguelton@mozilla.com>
Mon, 26 Dec 2022 07:51:47 +0000 (08:51 +0100)
committerserge-sans-paille <sguelton@mozilla.com>
Thu, 12 Jan 2023 11:08:01 +0000 (12:08 +0100)
commitbbe463d6ba268a2bfc45d539314b70cfd72d2360
tree5fc1a1ad8b573aff1ccf176f1331451860344957
parent87e547d8f035c8de321e246629dd2b1ccec31662
[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
clang/include/clang/Driver/Options.td
clang/lib/Driver/DriverOptions.cpp
llvm/include/llvm/Option/OptTable.h
llvm/lib/Option/OptTable.cpp
llvm/utils/TableGen/OptParserEmitter.cpp