Skip to content

Commit 6a43523

Browse files
[mlir][WIP] Set up RTTI for ValueBoundsConstraintSet
1 parent f1aa783 commit 6a43523

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "mlir/IR/Value.h"
1616
#include "mlir/Interfaces/DestinationStyleOpInterface.h"
1717
#include "llvm/ADT/SetVector.h"
18+
#include "llvm/Support/ExtensibleRTTI.h"
1819

1920
#include <queue>
2021

@@ -63,7 +64,8 @@ using ValueDimList = SmallVector<std::pair<Value, std::optional<int64_t>>>;
6364
///
6465
/// Note: Any modification of existing IR invalides the data stored in this
6566
/// class. Adding new operations is allowed.
66-
class ValueBoundsConstraintSet {
67+
class ValueBoundsConstraintSet
68+
: public llvm::RTTIExtends<ValueBoundsConstraintSet, llvm::RTTIRoot> {
6769
protected:
6870
/// Helper class that builds a bound for a shaped value dimension or
6971
/// index-typed value.
@@ -107,6 +109,8 @@ class ValueBoundsConstraintSet {
107109
};
108110

109111
public:
112+
static char ID;
113+
110114
/// The stop condition when traversing the backward slice of a shaped value/
111115
/// index-type value. The traversal continues until the stop condition
112116
/// evaluates to "true" for a value.

mlir/lib/Interfaces/ValueBoundsOpInterface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ static std::optional<int64_t> getConstantIntValue(OpFoldResult ofr) {
7070
ValueBoundsConstraintSet::ValueBoundsConstraintSet(MLIRContext *ctx)
7171
: builder(ctx) {}
7272

73+
char ValueBoundsConstraintSet::ID = 0;
74+
7375
#ifndef NDEBUG
7476
static void assertValidValueDim(Value value, std::optional<int64_t> dim) {
7577
if (value.getType().isIndex()) {

0 commit comments

Comments
 (0)