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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 12:27:02 PST 2024


================
@@ -113,10 +113,10 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
   ValueVector::iterator I, IE, J, JE;
 
   for (I = MemInstr.begin(), IE = MemInstr.end(); I != IE; ++I) {
-    for (J = I, JE = MemInstr.end(); J != JE; ++J) {
+    for (J = I + 1, JE = MemInstr.end(); J != JE; ++J) {
----------------
Meinersbur wrote:

https://godbolt.org/z/Tacx7M7M7

There is just a single MemInst (a StoreInst) in the loop body, hence `I == J` is the only check that would prevent the loop being interchanged.

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


More information about the llvm-commits mailing list