[all-commits] [llvm/llvm-project] d6da02: [llvm] Add enum iteration to Sequence

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Wed Jul 21 05:49:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6da02d952470ac976824da9aefdfb13ea1dde34
      https://github.com/llvm/llvm-project/commit/d6da02d952470ac976824da9aefdfb13ea1dde34
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2021-07-21 (Wed, 21 Jul 2021)

  Changed paths:
    M llvm/include/llvm/ADT/Sequence.h
    M llvm/include/llvm/Support/MachineValueType.h
    M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    M llvm/tools/llvm-exegesis/lib/X86/Target.cpp
    M llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
    M llvm/unittests/ADT/SequenceTest.cpp
    M llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
    M llvm/unittests/IR/ConstantRangeTest.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

  Log Message:
  -----------
  [llvm] Add enum iteration to Sequence

This patch allows iterating typed enum via the ADT/Sequence utility.

It also changes the original design to better separate concerns:
 - `StrongInt` only deals with safe `intmax_t` operations,
 - `SafeIntIterator` presents the iterator and reverse iterator
 interface but only deals with safe `StrongInt` internally.
 - `iota_range` only deals with `SafeIntIterator` internally.

 This design ensures that operations are always valid. In particular,
 "Out of bounds" assertions fire when:
  - the `value_type` is not representable as an `intmax_t`
  - iterator operations make internal computation underflow/overflow
  - the internal representation cannot be converted back to `value_type`

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




More information about the All-commits mailing list