This is a follow-up patch to D122857 where we added delinearization of fixed-size arrays to loop cache analysis, which resulted in some duplicate code ("tryDelinearizeFixedSize()") in LoopCacheCost.cpp and DependenceAnalysis.cpp. Refactoring is done in this patch.
This patch refactors IndexedReference::tryDelinearizeFixedSize() out as tryDelinearizeFixedSizeImpl() and moves it to Delinearization.cpp, such that clients can reuse llvm::tryDelinearizeFixedSizeImpl() wherever they would like to delinearize fixed-size arrays. Currently it has two users, i.e., DependenceAnalysis.cpp and LoopCacheCost.cpp.
In DependenceAnalysis.cpp, tryDelinearizeFixedSize(Src, Dst, SrcAccessFn, DstAccessFn, SrcSubscripts, DstSubscripts) now calls tryDelinearizeFixedSizeImpl(SE, Src, SrcAccessFn, SrcSubscripts, SrcSizes) and tryDelinearizeFixedSizeImpl(SE, Dst, DstAccessFn, DstSubscripts, DstSizes) to delinearize Src and Dst respectively, and does some clean-up work afterwards that is needed in dependence analysis. Similarly in LoopCacheCost.cpp, tryDelinearizeFixedSize() calls tryDelinearizeFixedSizeImpl() and does some clean-up work afterwards that is needed in loop cache analysis.
I'm looking forward to comments on this patch :)
"can be reused wherever needed with the llvm namespace" does not need documentation.