[llvm] [LoopInterchange] Motivating example for interchange enablement. NFC. (PR #171631)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 10:51:12 PST 2025
================
@@ -0,0 +1,543 @@
+; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -pass-remarks-missed='loop-interchange' -pass-remarks-output=%t -S
+; RUN: FileCheck --input-file=%t %s
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
+
+; The IR test case below is a full and representative example of a more complex
+; loop nest structure where we would like to see loops 'j' and 'JL' get
+; interchanged. This is the pseudo-code of the loop nest to get and idea of
+; the stucture:
+;
+; for L=1 to NX
+; for M=1 to NY
+; for i=1 to NX
+; for j=1 to NY
+; for IL=1 to NX
+; for JL=1 to NY
+; GlobC(j,JL,M) + GlobG(j,JL,M) + GlobE(j,JL,M) + GlobI(j,JL,M)
+; End
+; End
----------------
kasuga-fj wrote:
```suggestion
; for IL=1 to NX
; load GlobC(i,IL,L)
; load GlobG(i,IL,L)
; load GlobE(i,IL,L)
; load GlobI(i,IL,L)
; for JL=1 to NY
; load GlobD(j,JL,M)
; load GlobH(j,JL,M)
; load GlobF(j,JL,M)
; load GlobJ(j,JL,M)
; store GlobL(NY*i+j,NY*IL+JL)
; End
; End
```
If I understand correctly, this pseudo code is not consistent with the IR. If you find this format awkward, please feel free to correct it.
https://github.com/llvm/llvm-project/pull/171631
More information about the llvm-commits
mailing list