This is an archive of the discontinued LLVM Phabricator instance.

[mlir:TypeID] Use a static variable for explicit TypeIDs
AbandonedPublic

Authored by rriddle on Feb 15 2022, 10:08 AM.

Details

Reviewers
mehdi_amini
Summary

When the explicit type id macros were added, they unfortunately moved
the definitions of the TypeID::get functions to the .cpp files. This commit
moves the method definition back to the header and instead uses a
global variable (declared in the header as well) to anchor the definition
to a specific translation unit. This leads to much more optimal code
for TypeID::get, and has improved the compile time of some benchmarks
by anywhere from 3.5-10%.

Diff Detail

Event Timeline

rriddle created this revision.Feb 15 2022, 10:08 AM
rriddle requested review of this revision.Feb 15 2022, 10:08 AM

Did you look into the build failures?

Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 9:02 PM
rriddle abandoned this revision.Mar 30 2022, 10:24 PM

This is subsumed by D122775, which has a better reworking of TypeID in general.