This is an archive of the discontinued LLVM Phabricator instance.

[IR] Store attributes that are available "somewhere" (NFC)
ClosedPublic

Authored by nikic on Jun 15 2020, 12:46 PM.

Details

Summary

I noticed that for some benchmarks we spend quite a bit of time inside AttributeList::hasAttrSomewhere(), mainly when checking for the returned attribute. Most of the time the attribute will not be present, in which case this function has to walk through the whole attribute list and check for the attribute at each index.

This patch proposes to add a cache of all "available somewhere" attributes inside AttributeListImpl. This makes the structure 12 bytes larger, but I don't think that's problematic, as attribute lists are uniqued. Compile-time improves by 0.4% on average, but >1% for sqlite.

Diff Detail

Event Timeline

nikic created this revision.Jun 15 2020, 12:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2020, 12:46 PM
jdoerfert accepted this revision.Jun 24 2020, 12:42 PM

LGTM. Thx!

This revision is now accepted and ready to land.Jun 24 2020, 12:42 PM
This revision was automatically updated to reflect the committed changes.