This patch fixes an invalid TypeSize->uint64_t implicit conversion in
FoldReinterpretLoadFromConst. We now check to see if the offset is
greater than or equal to the known minimum size of the constant. In
addition, I have added support for scalable vector splats in
ReadDataFromGlobal, since we can support load-store forwarding
when we know the offset is safe.
Tests added here:
Transforms/InstCombine/load-store-forward.ll
Can you split out all changes to make ReadDataFromGlobal work on scalable splats into a separate patch? I think the changes aren't trivial, and we want a fix for the assertion-failures in LLVM 14. The improvements to make this optimisation work for scalable vectors is less urgent.