This fixes an issue in One-Shot Bufferize that could lead to missing buffer copies in the future. This bug can currently not be triggered because of the order in which ops are analyzed (always bottom-to-top). However, if we consider different traversal orders for the analysis in the future, this bug can cause subtle issues that are difficult to debug.
%0 = ... %1 = tensor.insert ... into %0 %2 = tensor.extract_slice %0 tensor.extract %2[...]
In case of a top-to-bottom analysis of the above IR, the tensor.insert is analyzed before the tensor.extract_slice. In that case, the tensor.insert will bufferize in-place because %2 is not yet known to become an alias of %0 (and therefore causing a conflict).
With this change, the tensor.insert will bufferize out-of-place, regardless of the traversal order.
Note: As this bug cannot be triggered with the current traversal order, there is no test case for this change. However, a subsequent change will introduce an improvement to loop buffferization that depends on this change. That change will have a test case that depends on this fix.