[all-commits] [llvm/llvm-project] 32a548: TableGen: Let getAllDerivedDefinitions() numeric o...

NAKAMURA Takumi via All-commits all-commits at lists.llvm.org
Thu Mar 30 14:01:38 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32a5482e3c83ef7302cd9c5a1c3afb8c2c4c2d28
  Author: NAKAMURA Takumi <geek4civic at gmail.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    M llvm/lib/TableGen/Record.cpp
    M llvm/test/CodeGen/AMDGPU/greedy-alloc-fail-sgpr1024-spill.mir
    M llvm/test/CodeGen/AMDGPU/ipra-regmask.ll
    M llvm/test/CodeGen/AMDGPU/spill-to-agpr-partial.mir
    M llvm/test/CodeGen/AMDGPU/splitkit-copy-bundle.mir
    M llvm/test/CodeGen/AMDGPU/vector-spill-restore-to-other-vector-type.mir
    M llvm/test/TableGen/RegisterInfoEmitter-regcost-tuple.td

  Log Message:
  TableGen: Let getAllDerivedDefinitions() numeric order.

Since `RK::Recs` is sorted by character order, anonymous defs will be
enumerated like this;

  - anonymous_0
  - anonymous_1
  - anonymous_10
  - anonymous_100
  - anonymous_1000
  - ...
  - anonymous_99
  - anonymous_990
  - ...
  - anonymous_999

Some records around each gap might be wrapped around along increase or
decrease of records in middle. Then output order of anonymous defs
might be changed.

Numeric sort is expected to prevent such wrap-arounds.
This can be implemented with `StringRef::compare_numeric()`.

  - ...
  - anonymous_99
  - anonymous_100
  - ...
  - anonymous_999
  - anonymous_1000
  - ...

See also discussions in D145874.

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

More information about the All-commits mailing list