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

Vedant Paranjape via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 02:59:25 PDT 2023


vedant-amd created this revision.
Herald added a project: All.
vedant-amd requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156304

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


Index: llvm/include/llvm/Analysis/LoopAccessAnalysis.h
===================================================================
--- llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -200,7 +200,7 @@
 
   /// 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156304.544276.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230726/c4510642/attachment.bin>


More information about the llvm-commits mailing list