[PATCH] D69914: [LVI] Normalize pointer behavior

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 12:01:15 PST 2019


reames requested changes to this revision.
reames added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:162
       SmallDenseSet<AssertingVH<Value>, 4> OverDefined;
+      Optional<DenseSet<AssertingVH<Value>>> DereferencedPointers;
     };
----------------
Can you add a note to the comment about the None state being used to represent a block whose dereferenceability hasn't yet been memoized?  


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:687
+  Optional<bool> OptionalIsDereferenced =
+      TheCache.isPointerDereferencedInBlock(Val, BB);
+  if (OptionalIsDereferenced)
----------------
This function signature and usage seems needlessly complicated here.  Can I suggest something along the lines of the following:
if (None == TheCache[BB].DereferenceablePointers) {
  // populate cache
}

return TheCache[BB].DereferenceablePointers->count(V);

You could hide the population inside an ensureDereferenceabilityCached or getDereferenceablePointers interface if you wanted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69914/new/

https://reviews.llvm.org/D69914





More information about the llvm-commits mailing list