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

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 05:54:11 PST 2023


================
@@ -307,7 +173,7 @@ class AliasSetTracker {
   BatchAAResults &AA;
   ilist<AliasSet> AliasSets;
 
-  using PointerMapType = DenseMap<AssertingVH<Value>, AliasSet::PointerRec *>;
+  using PointerMapType = DenseMap<MemoryLocation, AliasSet *>;
----------------
brunodf-snps wrote:

I still realized there was a problem with commit 23443f3. When a memory location with an undef pointer value is added to an alias set, that alias set is not referenced from the pointer map entry of that pointer value (because the pointer value may appear in _multiple_ alias sets). But without the reference to the alias set from some access structure, the reference count of the set may reach zero, and the alias set may be dropped. (For similar reason, the reference count of an alias set is increased by 1 when at least one unknown instruction is registered in it.)

I solved this problem (on [the aforementioned branch](https://github.com/brunodf-snps/llvm-project/commits/ast-pointer-map/)) by keeping a collection with alias sets that contain undef pointer values. This keeps those alias sets referenced, so they are not dropped. It also allows to scan only those alias sets, when we are trying to find if a memory location with an undef pointer value is already registered or not.

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


More information about the llvm-commits mailing list