@@ -53,7 +53,7 @@ mlir::reifyResultShapes(OpBuilder &b, Operation *op,
53
53
// * Attribute for static dimensions
54
54
// * Value for dynamic dimensions
55
55
assert (shapedType.isDynamicDim (dim) ==
56
- reifiedReturnShapes[resultIdx][dim]. is <Value>( ) &&
56
+ isa<Value>( reifiedReturnShapes[resultIdx][dim]) &&
57
57
" incorrect implementation of ReifyRankedShapedTypeOpInterface" );
58
58
}
59
59
++resultIdx;
@@ -70,19 +70,19 @@ bool ShapeAdaptor::hasRank() const {
70
70
return false ;
71
71
if (auto t = llvm::dyn_cast_if_present<Type>(val))
72
72
return cast<ShapedType>(t).hasRank ();
73
- if (val. is <Attribute>())
73
+ if (isa <Attribute>(val ))
74
74
return true ;
75
- return val. get <ShapedTypeComponents *>()->hasRank ();
75
+ return cast <ShapedTypeComponents *>(val )->hasRank ();
76
76
}
77
77
78
78
Type ShapeAdaptor::getElementType () const {
79
79
if (val.isNull ())
80
80
return nullptr ;
81
81
if (auto t = llvm::dyn_cast_if_present<Type>(val))
82
82
return cast<ShapedType>(t).getElementType ();
83
- if (val. is <Attribute>())
83
+ if (isa <Attribute>(val ))
84
84
return nullptr ;
85
- return val. get <ShapedTypeComponents *>()->getElementType ();
85
+ return cast <ShapedTypeComponents *>(val )->getElementType ();
86
86
}
87
87
88
88
void ShapeAdaptor::getDims (SmallVectorImpl<int64_t > &res) const {
@@ -97,7 +97,7 @@ void ShapeAdaptor::getDims(SmallVectorImpl<int64_t> &res) const {
97
97
for (auto it : dattr.getValues <APInt>())
98
98
res.push_back (it.getSExtValue ());
99
99
} else {
100
- auto vals = val. get <ShapedTypeComponents *>()->getDims ();
100
+ auto vals = cast <ShapedTypeComponents *>(val )->getDims ();
101
101
res.assign (vals.begin (), vals.end ());
102
102
}
103
103
}
@@ -116,7 +116,7 @@ int64_t ShapeAdaptor::getDimSize(int index) const {
116
116
return cast<DenseIntElementsAttr>(attr)
117
117
.getValues <APInt>()[index]
118
118
.getSExtValue ();
119
- auto *stc = val. get <ShapedTypeComponents *>();
119
+ auto *stc = cast <ShapedTypeComponents *>(val );
120
120
return stc->getDims ()[index];
121
121
}
122
122
@@ -126,7 +126,7 @@ int64_t ShapeAdaptor::getRank() const {
126
126
return cast<ShapedType>(t).getRank ();
127
127
if (auto attr = llvm::dyn_cast_if_present<Attribute>(val))
128
128
return cast<DenseIntElementsAttr>(attr).size ();
129
- return val. get <ShapedTypeComponents *>()->getDims ().size ();
129
+ return cast <ShapedTypeComponents *>(val )->getDims ().size ();
130
130
}
131
131
132
132
bool ShapeAdaptor::hasStaticShape () const {
@@ -142,7 +142,7 @@ bool ShapeAdaptor::hasStaticShape() const {
142
142
return false ;
143
143
return true ;
144
144
}
145
- auto *stc = val. get <ShapedTypeComponents *>();
145
+ auto *stc = cast <ShapedTypeComponents *>(val );
146
146
return llvm::none_of (stc->getDims (), ShapedType::isDynamic);
147
147
}
148
148
@@ -162,7 +162,7 @@ int64_t ShapeAdaptor::getNumElements() const {
162
162
return num;
163
163
}
164
164
165
- auto *stc = val. get <ShapedTypeComponents *>();
165
+ auto *stc = cast <ShapedTypeComponents *>(val );
166
166
int64_t num = 1 ;
167
167
for (int64_t dim : stc->getDims ()) {
168
168
num *= dim;
0 commit comments