[all-commits] [llvm/llvm-project] 952c27: [RDA] Use TinyPtrVector to store reaching defs (NFCI)

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Apr 8 08:52:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 952c2741599ed492cedd37da895d7e81bc175ab9
      https://github.com/llvm/llvm-project/commit/952c2741599ed492cedd37da895d7e81bc175ab9
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-04-08 (Wed, 08 Apr 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/ReachingDefAnalysis.h

  Log Message:
  -----------
  [RDA] Use TinyPtrVector to store reaching defs (NFCI)

RDA currently uses SmallVector<int, 1> to store reaching definitions.
A SmallVector<int, 1> is 24 bytes large, and X86 currently has
164 register units, which means we need 3936 bytes per block.
If you have a large function with 1000 blocks, that's already 4MB.

A large fraction of these reg units will not have any reaching defs
(say, those corresponding to zmm registers), and many will have just
one. A TinyPtrVector serves this use-case much better, as it only
needs 8 bytes per register if it has 0 or 1 reaching defs.

As the name implies, TinyPtrVector is designed to work with pointers,
so we need to add some boilerplate to treat our reaching def integers
as pointers, using an appropriate encoding. We need to keep the low
bit free for tagging, and make sure at least one bit is set to
distinguish the null pointer.

Differential Revision: https://reviews.llvm.org/D77513




More information about the All-commits mailing list