The `candidateSliceOp` was replaces and used in a subsequent
call. Instead just replace its uses. The op is dead and will be
removed with CSE.
Differential Revision: https://reviews.llvm.org/D141869
};
/// Fuse the producer of the source of `candidateSliceOp` by computing the
-/// required slice of the producer in-place.
+/// required slice of the producer in-place. Note that the method
+/// replaces the uses of `candidateSliceOp` with the tiled and fused producer
+/// value but does not delete the slice operation.
struct SCFFuseProducerOfSliceResult {
OpResult origProducer; // Original untiled producer.
Value tiledAndFusedProducer; // Tile and fused producer value.
fusableProducer);
if (failed(fusedProducerValue))
return std::nullopt;
- rewriter.replaceOp(candidateSliceOp, fusedProducerValue.value());
+ rewriter.replaceAllUsesWith(candidateSliceOp, fusedProducerValue.value());
// 3. If the slice is for a destination operand, for example,
//