[all-commits] [llvm/llvm-project] 835076: [TableGen] Reduce the amount of storage space used...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Apr 18 15:34:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83507644ed1c59d76ca0b1ffc3e837fcb3677e41
      https://github.com/llvm/llvm-project/commit/83507644ed1c59d76ca0b1ffc3e837fcb3677e41
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-04-18 (Tue, 18 Apr 2023)

  Changed paths:
    M llvm/utils/TableGen/CodeGenDAGPatterns.cpp
    M llvm/utils/TableGen/CodeGenDAGPatterns.h

  Log Message:
  -----------
  [TableGen] Reduce the amount of storage space used for AddrSpaces in TypeSetByHwMode. NFC

We reserved 16 AddrSpaces in every TypeSetByHwMode. But we only ever
use the first one on targets that make use of the AddrSpace feature.

The vector was populated by pushing for each entry in the ArrayRef
passed to the TypeSetByHwMode constructor. Each entry is a
ValueTypeByHwMode that stores one VT for each HwMode.

The vector is accessed by a loop in TypeSetByHwMode::getValueTypeByHwMode.
That loop is over HwModes with in the TypeSetByHwMode. This is
unrelated to how the vector was created. The entries in the vector
don't represent HwModes.

The targets that use AddrSpace don't make use of HwModes so the
loop in getValueTypeByHwMode will only run 1 iteration. So we only
the first entry in the vector is meaningful used.

This patch simplifies things by storing only 1 AddrSpace in
TypeSetByMode. Reducing the memory used by TypeSetByHwMode.
More work will be needed to support HwModes with AddrSpace if we
need a different AddrSpace for each HwMode.

Reviewed By: arsenm

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




More information about the All-commits mailing list