This is an archive of the discontinued LLVM Phabricator instance.

Remove vptr dispatch from FoldingSet.
ClosedPublic

Authored by rsmith on Apr 15 2020, 3:02 PM.

Details

Summary

Instead of storing a vptr in each FoldingSet instance, form an
equivalent struct and pass it implicitly from FoldingSet into the
various FoldingSetBase methods.

This has three benefits:

  • FoldingSet becomes one pointer smaller.
  • Under LTO, the "virtual" functions are much easier to inline.
  • The element type no longer needs to be complete when instantiating FoldingSet<T>, only when instantiating an insert / lookup member.

Diff Detail

Event Timeline

rsmith created this revision.Apr 15 2020, 3:02 PM
rsmith updated this revision to Diff 257867.Apr 15 2020, 3:07 PM
rsmith marked an inline comment as done.

Remove unused changes to function_ref.

rnk accepted this revision.Apr 15 2020, 3:48 PM

lgtm

llvm/include/llvm/ADT/FoldingSet.h
493

final seems a bit superfluous now that it is not dynamic.

This revision is now accepted and ready to land.Apr 15 2020, 3:48 PM
rsmith marked an inline comment as done.Apr 15 2020, 5:19 PM
This revision was automatically updated to reflect the committed changes.