Lines Matching defs:reshape
1089 /// Fold dim of a memref reshape operation to a load into the reshape's shape
1096 auto reshape = dim.getSource().getDefiningOp<ReshapeOp>();
1098 if (!reshape)
1100 dim, "Dim op is not defined by a reshape op.");
1102 // dim of a memref reshape can be folded if dim.getIndex() dominates the
1103 // reshape. Instead of using `DominanceInfo` (which is usually costly) we
1105 // 1. dim.getIndex() is defined in the same block as reshape but before
1106 // reshape.
1108 // reshape.
1111 if (dim.getIndex().getParentBlock() == reshape->getBlock()) {
1113 if (reshape->isBeforeInBlock(definingOp)) {
1116 "dim.getIndex is not defined before reshape in the same block.");
1118 } // else dim.getIndex is a block argument to reshape->getBlock and
1119 // dominates reshape
1121 else if (dim->getBlock() != reshape->getBlock() &&
1123 reshape->getParentRegion())) {
1124 // If dim and reshape are in the same block but dim.getIndex() isn't, we
1125 // already know dim.getIndex() dominates reshape without calling
1128 dim, "dim.getIndex does not dominate reshape.");
1131 // Place the load directly after the reshape to ensure that the shape memref
1133 rewriter.setInsertionPointAfter(reshape);
1136 rewriter.create<LoadOp>(loc, reshape.getShape(), dim.getIndex());
2103 // Reassociative reshape ops
2635 setNameFn(getResult(), "reshape");
2661 "reshape to statically-ranked memref type");