diff options
author | serge-sans-paille <sguelton@mozilla.com> | 2022-12-26 08:51:47 +0100 |
---|---|---|
committer | serge-sans-paille <sguelton@mozilla.com> | 2023-01-12 12:08:01 +0100 |
commit | bbe463d6ba268a2bfc45d539314b70cfd72d2360 (patch) | |
tree | 5fc1a1ad8b573aff1ccf176f1331451860344957 /llvm/lib | |
parent | 87e547d8f035c8de321e246629dd2b1ccec31662 (diff) | |
download | llvm-bbe463d6ba268a2bfc45d539314b70cfd72d2360.zip llvm-bbe463d6ba268a2bfc45d539314b70cfd72d2360.tar.gz llvm-bbe463d6ba268a2bfc45d539314b70cfd72d2360.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Option/OptTable.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index 3b4e439..49d56c0 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -300,17 +300,6 @@ unsigned OptTable::findNearest(StringRef Option, std::string &NearestString, return BestDistance; } -bool OptTable::addValues(StringRef Option, const char *Values) { - for (size_t I = FirstSearchableIndex, E = OptionInfos.size(); I < E; I++) { - Info &In = OptionInfos[I]; - if (optionMatches(In, Option)) { - In.Values = Values; - return true; - } - } - return false; -} - // Parse a single argument, return the new argument, and update Index. If // GroupedShortOptions is true, -a matches "-abc" and the argument in Args will // be updated to "-bc". This overload does not support |