Previously, there could be a read scalar access for every use of a cross-stmt value and potentially multiple stores for a value definition. Check that such MemoryAccesses do not already exist before adding new ones. This will be used for De-LICM such that if removing a redundant read or write, there is no second variant left.
Instead of checking for each instruction individually whether it needs to be written, we can now "pull-in" a reload when required including the creation of a store of the definition which simplifies the creation of implicit MemoryAccesses a bit.
We also unify the PHI writes in non-affine subregions. Instead of writing them in the exiting block, we write them only in the subregion's exit. The former violates the requirement that implicits are not written until leaving the scop statement if the exiting block has also edges back into the subregion. In addition, generateScalarLoads and generateScalarStore do not have special versions for non-affine subregions anymore.
Is this change unrelated? Assuming it is, you can probably commit this as obvious.