[llvm] LAA: add missed swap when inverting src, sink (NFC) (PR #122254)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 03:16:47 PST 2025


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/122254

We miss swapping the types of the source and sink when the source and sink are inverted, leaving a footgun behind. Fix this.

>From 54341565af1bbb9861c706fef4c5a5fa81c468cd Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Thu, 9 Jan 2025 11:13:45 +0000
Subject: [PATCH] LAA: add missed swap when inverting src, sink (NFC)

We miss swapping the types of the source and sink when the source and
sink are inverted, leaving a footgun behind. Fix this.
---
 llvm/lib/Analysis/LoopAccessAnalysis.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 2c75d5625cb66d..de0f81c0b6a4bf 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1921,6 +1921,7 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize(
   if (StrideAPtr && *StrideAPtr < 0) {
     std::swap(Src, Sink);
     std::swap(AInst, BInst);
+    std::swap(ATy, BTy);
     std::swap(StrideAPtr, StrideBPtr);
   }
 



More information about the llvm-commits mailing list