[clang] [CIR] Implement CIRBasicAliasAnalysis::getUnderlyingObject (PR #215683)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 12 15:48:53 PDT 2026
================
@@ -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
More information about the cfe-commits
mailing list