[llvm] 363b3a6 - fix warning caused by ef4ecc3ceffcf3ef129640c813f823c974f9ba22

Bardia Mahjour via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 14:09:28 PDT 2022


Author: Bardia Mahjour
Date: 2022-05-02T17:06:27-04:00
New Revision: 363b3a645a1e30011cc8da624f13dac5fd915628

URL: https://github.com/llvm/llvm-project/commit/363b3a645a1e30011cc8da624f13dac5fd915628
DIFF: https://github.com/llvm/llvm-project/commit/363b3a645a1e30011cc8da624f13dac5fd915628.diff

LOG: fix warning caused by ef4ecc3ceffcf3ef129640c813f823c974f9ba22

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/LoopCacheAnalysis.h
    llvm/lib/Analysis/LoopCacheAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
index 34d5ce5e6b004..ebfd5bb4e4539 100644
--- a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
@@ -116,7 +116,7 @@ class IndexedReference {
   /// succesfully located and a negative value otherwise. For example given the
   /// indexed reference 'A[i][2j+1][3k+2]', the call
   /// 'getSubscriptIndex(loop-k)' would return value 2.
-  unsigned getSubscriptIndex(const Loop &L) const;
+  int getSubscriptIndex(const Loop &L) const;
 
   /// Return the coefficient used in the rightmost dimension.
   const SCEV *getLastCoefficient() const;

diff  --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 8ebf77b21afbf..eacd262184ad5 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -319,7 +319,7 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L,
     // iterations of the i-loop multiplied by iterations of the j-loop.
     RefCost = TripCount;
 
-    unsigned Index = getSubscriptIndex(L);
+    int Index = getSubscriptIndex(L);
     assert(Index >= 0 && "Cound not locate a valid Index");
 
     for (unsigned I = Index + 1; I < getNumSubscripts() - 1; ++I) {
@@ -510,8 +510,8 @@ bool IndexedReference::isConsecutive(const Loop &L, unsigned CLS) const {
   return SE.isKnownPredicate(ICmpInst::ICMP_ULT, Stride, CacheLineSize);
 }
 
-unsigned IndexedReference::getSubscriptIndex(const Loop &L) const {
-  for (auto Idx : seq<unsigned>(0, getNumSubscripts())) {
+int IndexedReference::getSubscriptIndex(const Loop &L) const {
+  for (auto Idx : seq<int>(0, getNumSubscripts())) {
     const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(getSubscript(Idx));
     if (AR && AR->getLoop() == &L) {
       return Idx;


        


More information about the llvm-commits mailing list