[llvm] 259d56d - [LoopAccessAnalysis] Add a const qualifier to getMaxSafeDepDistBytes()

Vedant Paranjape via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 02:45:25 PDT 2023


Author: Vedant Paranjape
Date: 2023-07-31T09:45:01Z
New Revision: 259d56d41d664d70f7b4360941c25c98f6f439b1

URL: https://github.com/llvm/llvm-project/commit/259d56d41d664d70f7b4360941c25c98f6f439b1
DIFF: https://github.com/llvm/llvm-project/commit/259d56d41d664d70f7b4360941c25c98f6f439b1.diff

LOG: [LoopAccessAnalysis] Add a const qualifier to getMaxSafeDepDistBytes()

Add a const qualifier to this API call, since this is a member of
MemoryDepChecker and LoopAccessInfo returns an object of this class as a
const, as follows:

const MemoryDepChecker &getDepChecker() const { return *DepChecker; }

If one tries to use function as follows:

LAI->getDepChecker().getMaxSafeDepDistBytes()

results in the following error:

passing ‘const llvm::MemoryDepChecker’ as ‘this’ argument discards
qualifiers

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D156304

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/LoopAccessAnalysis.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index eb35ef515a1fdd..bd754022fdfcde 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -200,7 +200,7 @@ class MemoryDepChecker {
 
   /// The maximum number of bytes of a vector register we can vectorize
   /// the accesses safely with.
-  uint64_t getMaxSafeDepDistBytes() { return MaxSafeDepDistBytes; }
+  uint64_t getMaxSafeDepDistBytes() const { return MaxSafeDepDistBytes; }
 
   /// Return the number of elements that are safe to operate on
   /// simultaneously, multiplied by the size of the element in bits.


        


More information about the llvm-commits mailing list