[Mlir-commits] [flang] [mlir] [RFC][mlir] ViewLikeOpInterface method for detecting partial views. (PR #164020)

Tom Eccles llvmlistbot at llvm.org
Thu Oct 23 01:47:10 PDT 2025


================
@@ -212,6 +212,10 @@ AliasResult AliasAnalysis::alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs,
     if (lhsSrc.origin == rhsSrc.origin) {
       LLVM_DEBUG(llvm::dbgs()
                  << "  aliasing because same source kind and origin\n");
+      // TODO: we should return PartialAlias here. Need to decide
+      // if returning PartialAlias for fir.pack_array is okay;
+      // if not, then we need to handle it specially to still return
+      // MayAlias.
----------------
tblah wrote:

>From the LLVM documentation:
> The PartialAlias response is used when the two memory objects are _known to be overlapping_ in some way, regardless of whether they start at the same address or not.

I guess it depends what exactly is meant by "object". Previously I had interpreted it as referring to the specific memory addresses which could be accessed. So `array(1:4)` and `array(3)` do overlap with each other but not with `array(100:200)`. Therefore I think array indexing (until analysed more carefully) should use `MayAlias` rather than `PartialAlias`.

Alternatively, if "object" means the entire allocation then `PartialAlias` makes sense here.

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


More information about the Mlir-commits mailing list