[PATCH] D106279: [llvm] Add enum iteration to Sequence

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 19 07:38:40 PDT 2021


gchatelet created this revision.
gchatelet added reviewers: courbet, Quuxplusone.
Herald added subscribers: dcaballe, cota, mravishankar, teijeong, dexonsmith, rdzhabarov, tatianashp, jdoerfert, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, hiraditya.
Herald added a reviewer: aartbik.
gchatelet requested review of this revision.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: llvm-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: MLIR, LLVM.

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`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106279

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106279.359789.patch
Type: text/x-patch
Size: 30378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210719/1fb7eec7/attachment.bin>


More information about the llvm-commits mailing list