bufferizesToMemoryWrite(OpResult) looks for OpOperands that bufferize to memory writes inside the region of the defining op (if it has one). Currently, if the reverse use-def chain stops at any value inside of the region, the OpResult is considered to bufferize to a memory write.
It is always safe to have false positives among bufferizesToMemoryWrite, so the previous implementation is also correct. However, it can lead to additional buffer copies.
Depends On: D141684