[PATCH] D42381: [DA] Correct size parameter from dependency analysis to AA

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 4 14:56:14 PDT 2018


hfinkel added inline comments.


================
Comment at: lib/Analysis/DependenceAnalysis.cpp:629
   const Value *BObj = GetUnderlyingObject(B, DL);
-  return AA->alias(AObj, DL.getTypeStoreSize(AObj->getType()),
-                   BObj, DL.getTypeStoreSize(BObj->getType()));
+  return AA->alias(AObj, BObj);
 }
----------------
> It's possible that the size here should be the size of the thing that AObj points to, as opposed to unknown

There are two problems here, and I think that we can fix them both. What we're really trying to do here is to identify disjoint underlying objects.

 * First, GetUnderlyingObject might not always return the underlying object (because it has a recursion-depth cutoff). Thus, we need to validate the fact that GetUnderlyingObject actually did return such a thing. So we really want to do:


  if (!isIdentifiedObject(AObj) || !isIdentifiedObject(BObj))
    return true;


 * At that point, the sizes are essentially irrelevant. and we should pass MemoryLocation::UnknownSize as the size. However, at that point, since we have unique underlying objects, we can just compare them, so we can just do (there's no further value in calling into AA):


  return AObj == BObj;




https://reviews.llvm.org/D42381





More information about the llvm-commits mailing list