================
@@ -69,14 +170,20 @@ mlir::AliasResult CIRBasicAliasAnalysis::alias(mlir::Value 
lhs,
     return mlir::AliasResult::MustAlias;
   }
 
-  if (areDistinctObjects(lhs, rhs)) {
+  ObjectRelation relation = classifyObjects(lhs, rhs);
+  switch (relation) {
+  case ObjectRelation::Distinct:
     LDBG() << "No alias between distinct objects";
     return mlir::AliasResult::NoAlias;
+  case ObjectRelation::Identical:
----------------
bcardosolopes wrote:

MustAlias means "the two locations precisely alias each other", and most of 
what reaches here is a strict subobject at offset 0: `get_member[0]`, 
`base_class_addr[0]`, `complex.real_ptr`, decay, a narrowing bitcast. `c1#0 <-> 
real1#0: MustAlias` reads as a store to the real half precisely aliasing the 
whole complex.

Seems like not a miscompile today (`getModRef` only branches on `isNo()`, and 
`LocalAliasAnalysis` is equally loose for memref subviews), but subobjects will 
be everywhere in CIR. `PartialAlias` when the offset is zero and the object is 
narrower, or do callers always pair the query with a size? Might be better to 
decide before the test matrix bakes it in.

https://github.com/llvm/llvm-project/pull/215683
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to