When there is a mix of affine load/store and non-affine operations (e.g. std.load, std.store),
affine-loop-fusion ignores the present of non-affine ops, thus changing the program semantics.
E.g. we have a program of three affine loops operating on the same memref in which one of them uses std.load and std.store, as follows.
affine.for affine.store %1 affine.for std.load %1 std.store %1 affine.for affine.load %1 affine.store %1
affine-loop-fusion will produce the following result which changed the program semantics:
affine.for std.load %1 std.store %1 affine.for affine.store %1 affine.load %1 affine.store %1
This patch is to fix the above problem by checking non-affine users of the memref that are between the source and destination nodes of interest.
Change to /// comments please.