[PATCH] D69914: [LVI] Normalize pointer behavior

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 12:10:12 PST 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:687
+  Optional<bool> OptionalIsDereferenced =
+      TheCache.isPointerDereferencedInBlock(Val, BB);
+  if (OptionalIsDereferenced)
----------------
reames wrote:
> 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.
The somewhat awkward API here is used to keep all the members of LazyValueInfoCache private -- I'd have to make parts of it public to allow directly populating the cache directly here.


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

https://reviews.llvm.org/D69914





More information about the llvm-commits mailing list