13
13
14
14
#include " mlir/IR/OpImplementation.h"
15
15
#include " llvm/ADT/EnumeratedArray.h"
16
+ #include " llvm/ADT/STLForwardCompat.h"
16
17
#include " llvm/ADT/SmallBitVector.h"
17
18
#include " llvm/ADT/StringMap.h"
18
19
@@ -31,13 +32,13 @@ namespace ir_detail {
31
32
enum class VarKind { Symbol = 1 , Dimension = 0 , Level = 2 };
32
33
33
34
[[nodiscard]] constexpr bool isWF (VarKind vk) {
34
- const auto vk_ = to_underlying (vk);
35
+ const auto vk_ = llvm:: to_underlying (vk);
35
36
return 0 <= vk_ && vk_ <= 2 ;
36
37
}
37
38
38
39
// / Swaps `Dimension` and `Level`, but leaves `Symbol` the same.
39
40
constexpr VarKind flipVarKind (VarKind vk) {
40
- return VarKind{2 - to_underlying (vk)};
41
+ return VarKind{2 - llvm:: to_underlying (vk)};
41
42
}
42
43
static_assert (flipVarKind(VarKind::Symbol) == VarKind::Symbol &&
43
44
flipVarKind (VarKind::Dimension) == VarKind::Level &&
@@ -49,7 +50,7 @@ constexpr char toChar(VarKind vk) {
49
50
// in the range [-44..126] (where that lower bound is under worst-case
50
51
// rearranging of the expression); and `int_fast8_t` is the fastest type
51
52
// which can support that range without over-/underflow.
52
- const auto vk_ = static_cast <int_fast8_t >(to_underlying (vk));
53
+ const auto vk_ = static_cast <int_fast8_t >(llvm:: to_underlying (vk));
53
54
return static_cast <char >(100 + vk_ * (26 - vk_ * 11 ));
54
55
}
55
56
static_assert (toChar(VarKind::Symbol) == ' s' &&
@@ -100,7 +101,7 @@ class Var {
100
101
public:
101
102
constexpr Impl (VarKind vk, Num n)
102
103
: data((static_cast <Storage>(n) << 2) |
103
- static_cast<Storage>(to_underlying(vk))) {
104
+ static_cast<Storage>(llvm:: to_underlying(vk))) {
104
105
assert (isWF (vk) && " unknown VarKind" );
105
106
assert (isWF_Num (n) && " Var::Num is too large" );
106
107
}
@@ -215,7 +216,7 @@ class Ranks final {
215
216
216
217
static constexpr unsigned to_index (VarKind vk) {
217
218
assert (isWF (vk) && " unknown VarKind" );
218
- return static_cast <unsigned >(to_underlying (vk));
219
+ return static_cast <unsigned >(llvm:: to_underlying (vk));
219
220
}
220
221
221
222
public:
@@ -349,7 +350,7 @@ class VarEnv final {
349
350
// / to live too long.
350
351
VarInfo const &access (VarInfo::ID id) const {
351
352
// `SmallVector::operator[]` already asserts the index is in-bounds.
352
- return vars[to_underlying (id)];
353
+ return vars[llvm:: to_underlying (id)];
353
354
}
354
355
VarInfo const *access (std::optional<VarInfo::ID> oid) const {
355
356
return oid ? &access (*oid) : nullptr ;
0 commit comments