The foldMemRefCast method is defined in memref namespace; the foldTensorCast method is defined in tensor namespace. This revision deletes the dup code and use the unified methods. Reviewed By: dcaballe Differential Revision: https://reviews.llvm.org/D136379