This is an archive of the discontinued LLVM Phabricator instance.

[OptTable] Make ValuesCode initialisation of Options constexpr
ClosedPublic

Authored by serge-sans-paille on Dec 27 2022, 9:25 AM.

Details

Summary

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

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2022, 9:25 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
serge-sans-paille requested review of this revision.Dec 27 2022, 9:25 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 27 2022, 9:25 AM
serge-sans-paille retitled this revision from [clang] Make ValuesCode initialisation of Options constexpr to [OptTable] Make ValuesCode initialisation of Options constexpr.

(rebased on main)

nikic added inline comments.Jan 11 2023, 7:28 AM
llvm/utils/TableGen/OptParserEmitter.cpp
268

Isn't this assert the wrong way around?

nits + rebased on main

serge-sans-paille marked an inline comment as done.Jan 11 2023, 12:49 PM
nikic accepted this revision.Jan 12 2023, 12:57 AM

LGTM

This revision is now accepted and ready to land.Jan 12 2023, 12:57 AM
This revision was landed with ongoing or failed builds.Jan 12 2023, 3:08 AM
This revision was automatically updated to reflect the committed changes.