Restrict canonicalization to avoid changing type
Issue #47516 PiperOrigin-RevId: 363300979
This commit is contained in:
parent
caae2525ef
commit
a58e62590e
|
@ -36,12 +36,13 @@ def DynamicBroadcastToOwnShape_4 : Pat<
|
||||||
(HLO_DynamicBroadcastInDimOp:$op $x, (Tensor_CastOp (Shape_ShapeOfOp $x)), $attr),
|
(HLO_DynamicBroadcastInDimOp:$op $x, (Tensor_CastOp (Shape_ShapeOfOp $x)), $attr),
|
||||||
(Tensor_CastOp $x)>;
|
(Tensor_CastOp $x)>;
|
||||||
|
|
||||||
def ShapeOfDynamicReshape : Pat<
|
|
||||||
(Shape_ShapeOfOp (HLO_DynamicReshapeOp $x, $shape)),
|
|
||||||
(replaceWithValue $shape)>;
|
|
||||||
|
|
||||||
def HasSameType : Constraint<CPred<"$0.getType() == $1.getType()">>;
|
def HasSameType : Constraint<CPred<"$0.getType() == $1.getType()">>;
|
||||||
|
|
||||||
|
def ShapeOfDynamicReshape : Pat<
|
||||||
|
(Shape_ShapeOfOp:$op (HLO_DynamicReshapeOp $x, $shape)),
|
||||||
|
(replaceWithValue $shape),
|
||||||
|
[(HasSameType $shape, $op)]>;
|
||||||
|
|
||||||
def IdentityBroadcastReshape : Pat<
|
def IdentityBroadcastReshape : Pat<
|
||||||
(HLO_ReshapeOp:$op (HLO_BroadcastOp $input, $dims)),
|
(HLO_ReshapeOp:$op (HLO_BroadcastOp $input, $dims)),
|
||||||
(replaceWithValue $input),
|
(replaceWithValue $input),
|
||||||
|
|
Loading…
Reference in New Issue