[llvm] [TBAA] Fix the case where a subobject gets accessed at a non-zero offset. (PR #101485)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 04:51:24 PDT 2024


================
@@ -613,12 +613,13 @@ static bool mayBeAccessToSubobjectOf(TBAAStructTagNode BaseTag,
     }
 
     if (BaseType.getNode() == SubobjectTag.getBaseType()) {
----------------
kosarev wrote:

Once the type of the current base type matched the type of the subobject type, we see if the accesses within these same-typed objects may alias. So far we were just looking at the offsets, which doesn't work when one of the accesses dereferences the whole object, meaning offset 0, and the other dereferences its field/element at offset other than 0. The change fixes that by catching the case where any of the accesses are whole-object ones.

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


More information about the llvm-commits mailing list