[llvm-branch-commits] [llvm] [LoopInterchange] Add test for multiple accesses to same base ptr (NFC) (PR #193476)

Sjoerd Meijer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 18 06:23:29 PDT 2026


================
@@ -188,3 +188,87 @@ loop.i.latch:
 exit:
   ret void
 }
+
+; for (i = 0; i < 10; i++)
+;   for (j = 0; j < 10; j++)
+;     A[100*i + j] = B[100*i + j] + C[i + 100*j] + C[i + 99*j] + C[i + 98*j];
+;
+; The above loop should NOT be interchanged in terms of locality of reference.
----------------
sjoerdmeijer wrote:

> 100 is a completely arbitrary value. Would it be better to clarify that this (and 99, 98) is an arbitrary value, e.g., by using 42?

When I read the test case a first time, I thought 100 was because of the loop bound, but then I realised it wasn't. I then thought 100 was indeed an arbitrary value that maybe exceed a cache line. But yeah, either way, making explicit that this is an arbitrary value (not related to loop bounds) one way or another is probably a good clarification. 

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


More information about the llvm-branch-commits mailing list