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

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 02:21:46 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'd still expect all MemoryLocations for the same Value to be in the same AliasSet

I was unsure if this always holds. In case of full restrict support, I think the same pointer value is used for the two stores in the following snippet:

```
int * restrict r = p;
*p = 123;
*r = 456;
```

But they have different provenance and metadata, and ScopedNoAliasAA will report that they do not alias. But this snippet has undefined behavior (because of course, the accesses do alias).

I guess that BasicAA will quickly return MustAlias for a query with the same pointer Value regardless of LocationSize, metadata, etc.? Then indeed another AA can only say NoAlias in an illegal situation.

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


More information about the llvm-commits mailing list