Remove vptr dispatch from FoldingSet.
authorRichard Smith <richard@metafoo.co.uk>
Wed, 15 Apr 2020 22:00:08 +0000 (15:00 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Thu, 16 Apr 2020 00:39:35 +0000 (17:39 -0700)
commit1132c75bd77a4ae5e4634e22ac693128e3f39e5c
treed1bae7dc893d45c45b31c34a34b4454be5b668b8
parentedccc35e8fa2c546e0ef1c8efde56e6b12e3c175
Remove vptr dispatch from FoldingSet.

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.

Reviewers: rnk

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78247
llvm/include/llvm/ADT/FoldingSet.h
llvm/lib/Support/FoldingSet.cpp