This is an archive of the discontinued LLVM Phabricator instance.

[AttrBuilder] Change storage to sorted vector
ClosedPublic

Authored by nikic on Jan 18 2022, 5:24 AM.

Details

Summary

This follows up on the work in D116599, which changed AttrBuilder to store string attributes as SmallVector<Attribute>. This patch changes the implementation to store *all* attributes as a sorted vector.

Doing this both makes the implementation simpler, and gives a sizable compile-time improvement: https://llvm-compile-time-tracker.com/compare.php?from=e7bfe83773c000da13a8e2495b6230e846a322c4&to=3668e3d5a34dd713615dce96a5eb7de21b295772&stat=instructions

Depends on D117552.

Diff Detail

Event Timeline

nikic created this revision.Jan 18 2022, 5:24 AM
nikic requested review of this revision.Jan 18 2022, 5:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 5:24 AM
aeubanks accepted this revision.Jan 18 2022, 10:59 AM
aeubanks added inline comments.
llvm/lib/IR/Attributes.cpp
1529

perhaps a note about string attrs being considered greater than enum attrs would be nice

1706

no longer relevant

1708

could make this O(n) since they're both sorted, maybe a FIXME

This revision is now accepted and ready to land.Jan 18 2022, 10:59 AM
llvm/lib/IR/Attributes.cpp
1520

could be an assert?

This revision was landed with ongoing or failed builds.Jan 19 2022, 3:29 AM
This revision was automatically updated to reflect the committed changes.
nikic marked 4 inline comments as done.