@@ -139,8 +139,8 @@ def HasNoUseOf: Constraint<CPred<"$_self.use_empty()">, "has no use">;
139139
140140// Check if two values have a ShapedType with the same element type.
141141def HasSameElementType : Constraint<
142- CPred<"$0.getType().cast<ShapedType>( ).getElementType() == "
143- "$1.getType().cast<ShapedType>( ).getElementType()">,
142+ CPred<"cast<ShapedType>( $0.getType()).getElementType() == "
143+ "cast<ShapedType>( $1.getType()).getElementType()">,
144144 "values have same element type">;
145145
146146def : Pattern<(TwoResultOp:$results $input),
@@ -161,8 +161,8 @@ Constraint HasNoUseOf(value: Value) [{
161161 return success(value.use_empty());
162162}];
163163Constraint HasSameElementType(value1: Value, value2: Value) [{
164- return success(value1.getType(). cast<ShapedType>().getElementType() ==
165- value2.getType(). cast<ShapedType>().getElementType());
164+ return success(cast<ShapedType>(value1.getType() ).getElementType() ==
165+ cast<ShapedType>(value2.getType() ).getElementType());
166166}];
167167
168168Pattern {
@@ -1105,8 +1105,8 @@ static LogicalResult hasOneUseImpl(PatternRewriter &rewriter, Value value) {
11051105}
11061106static LogicalResult hasSameElementTypeImpl(PatternRewriter &rewriter,
11071107 Value value1, Value Value2) {
1108- return success(value1.getType(). cast<ShapedType >().getElementType() ==
1109- value2.getType(). cast<ShapedType >().getElementType());
1108+ return success(cast<ShapedType >(value1.getType() ).getElementType() ==
1109+ cast<ShapedType >(value2.getType() ).getElementType());
11101110}
11111111
11121112void registerNativeConstraints(RewritePatternSet &patterns) {
@@ -1129,8 +1129,8 @@ Constraint HasOneUse(value: Value) [{
11291129 return success(value.hasOneUse());
11301130}];
11311131Constraint HasSameElementType(value1: Value, value2: Value) [{
1132- return success(value1.getType(). cast<ShapedType>().getElementType() ==
1133- value2.getType(). cast<ShapedType>().getElementType());
1132+ return success(cast<ShapedType>(value1.getType() ).getElementType() ==
1133+ cast<ShapedType>(value2.getType() ).getElementType());
11341134}];
11351135
11361136Pattern {
@@ -1160,8 +1160,8 @@ LogicalResult HasOneUse(PatternRewriter &rewriter, Value value) {
11601160 return success(value.hasOneUse());
11611161}
11621162LogicalResult HasSameElementType(Value value1, Value value2) {
1163- return success(value1.getType(). cast<ShapedType >().getElementType() ==
1164- value2.getType(). cast<ShapedType >().getElementType());
1163+ return success(cast<ShapedType >(value1.getType() ).getElementType() ==
1164+ cast<ShapedType >(value2.getType() ).getElementType());
11651165}
11661166```
11671167
0 commit comments