[llvm] [LoopInterchange] Constrain LI within supported loop nest depth (PR #118656)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 09:14:34 PST 2025


madhur13490 wrote:

Thanks @Meinersbur and @sjoerdmeijer for the comments.
I have removed the dependence analysis check and thus `-debug` requirement.

As @Meinersbur suggested, I reran on compile-time-tracker and PFA screenshot - the benefits are clearly visible for the branch `perf/max-depth-exp`. The first commit on this branch enables the loop interchange and the second commit applied this patch.




<img width="1294" alt="Screenshot 2025-01-21 at 10 27 28 PM" src="https://github.com/user-attachments/assets/39746816-c05f-4f1a-8036-315c56ccce91" />


> I don't think any of the sources from test-suite used by by the compile-time-tracker has loops that deep. I don't think it matters anyway, based on bubble-sort already is a convinving argument that an upper bound it needed.

I don't know if compile-time-tracker covers everything that is present in LLVM Test-suite but when I ran locally here is a quick stat.
I dumped depth of loop nest (using `LoopList.size()`) for each file in the LLVM test suite at the beginning of `run()`.  When the transformation is enabled, `run()` fucntion is invoked 139323 times on the entire LVM test suite and there are 238 loops whose depth is more than 10.  238/139323 seems much less, but there are indeed loops with huge depth in the test suite. Max Loop nest depth is 122!

Thanks for the approval. I will land the patch soon giving some more time in case anyone else wants to comment.




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


More information about the llvm-commits mailing list