[llvm] [LoopInterchange] Fix depends() check parameters (PR #77719)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 23:16:18 PST 2024


ShivaChen wrote:

Loop Access Analysis would use distance's direction for validation. LAA is using `SinkSCEV - SrcSCEV` to calculate distance. Dependence Analysis used by loop interchange is using `SrcSCEV - DstSCEV(SinkSECV)`. So reverse the call site Dst and Src can sync with LAA. Another observation is that LAA using LoopBlocksRPO to traverse the blocks with program order. GCC use get_loop_body_in_dom_order to traverse blocks with program order. GCC's build_classic_dist_vector will have leftmost distance always positive by reverse the direction and record DDR_REVERSED_P to determine whether the vector has been reversed. In gimple-loop-interchange.cc, gcc will consider DDR_REVERSED_P, that is it will use original distance signedness to  determine the validation. 
An alternative method would rely on normalize to reverse the distance: https://github.com/llvm/llvm-project/pull/78951.

https://github.com/llvm/llvm-project/pull/77719


More information about the llvm-commits mailing list