Skip to content

Commit

Permalink
Fix deprecated uses of template dyn_cast/isa (#2184)
Browse files Browse the repository at this point in the history
This was missed in #2180
  • Loading branch information
mlevesquedion authored Apr 9, 2024
1 parent 1c5bad7 commit 65f4c3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions stablehlo/dialect/StablehloOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,7 @@ template <typename Op>
LogicalResult reifyGatherShape(Op* op, OpBuilder& builder, ValueRange operands,
SmallVectorImpl<Value>& reifiedReturnShapes) {
// No support for unranked gather output shape a.t.m.
auto resultTy =
op->getResult().getType().template dyn_cast<RankedTensorType>();
auto resultTy = dyn_cast<RankedTensorType>(op->getResult().getType());
if (!resultTy) return failure();

typename Op::Adaptor adaptor(operands);
Expand Down
2 changes: 1 addition & 1 deletion stablehlo/transforms/StablehloRefineShapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ template <typename OpType, typename FuncType>
LogicalResult evalElementwise(PatternRewriter& rewriter, OpType op,
FuncType fn) {
auto resultType = op.getType();
if (!resultType.getElementType().template isa<IntegerType>())
if (!isa<IntegerType>(resultType.getElementType()))
return rewriter.notifyMatchFailure(op,
"expected integer result tensor type");

Expand Down
8 changes: 4 additions & 4 deletions stablehlo/transforms/VhloLegalizeToStablehlo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ SpecialResult convertSpecial(const OpConversionPattern<VhloOpTy>& pattern,
//===----------------------------------------------------------------------===//

bool isBoolean(Attribute vhloAttr, bool value) {
auto attr = vhloAttr.template dyn_cast_or_null<vhlo::BooleanV1Attr>();
auto attr = dyn_cast_or_null<vhlo::BooleanV1Attr>(vhloAttr);
return attr && attr.getValue() == value;
}

Expand All @@ -629,7 +629,7 @@ bool isEmptyTensor(Attribute vhloAttr) {
bool isEnum(Attribute vhloAttr, Attribute value) { return vhloAttr == value; }

bool isInteger(Attribute vhloAttr, int64_t value) {
auto attr = vhloAttr.template dyn_cast_or_null<vhlo::IntegerV1Attr>();
auto attr = dyn_cast_or_null<vhlo::IntegerV1Attr>(vhloAttr);
return attr && attr.getValue().getSExtValue() == value;
}

Expand All @@ -643,8 +643,8 @@ bool isSplatArray(Attribute vhloAttr, Attribute splatValue) {
template <typename T>
bool isSplatTensor(const ConversionPattern& pattern, Attribute vhloAttr,
T splatValue) {
auto attr = convertGeneric(vhloAttr, pattern.getTypeConverter())
.template dyn_cast_or_null<DenseElementsAttr>();
auto attr = dyn_cast_or_null<DenseElementsAttr>(
convertGeneric(vhloAttr, pattern.getTypeConverter()));
return attr && attr.isSplat() &&
attr.template getSplatValue<T>() == splatValue;
}
Expand Down

0 comments on commit 65f4c3e

Please sign in to comment.