[llvm] [polly] [AST] Don't merge memory locations in AliasSetTracker (PR #65731)

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 01:58:19 PST 2023


================
@@ -1100,7 +1100,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
     // collect MemAccessInfos for later.
     SmallVector<MemAccessInfo, 4> AccessInfos;
     for (const auto &A : AS) {
-      Value *Ptr = A.getValue();
+      Value *Ptr = const_cast<Value *>(A.Ptr);
----------------
brunodf-snps wrote:

I'm not happy about it either, but I don't immediately see how this can be improved. Conceptually, analyses can use `const Value *`. `MemoryLocation` and AA is doing this, but other analyses are not: that leads to some const-casts (also before this change `LoopAccessAnalysis` had some of these casts). Another source of const-casts is that a transformation retrieves `const Value *` from an analysis, and casts away the const qualification to work on them (that is fine, if the values fed into the analysis were non-const to begin with).

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


More information about the llvm-commits mailing list