[PATCH] D102550: [ValueTracking] Mark GEP operand as nonnull if the result was loaded or stored

Danila Kutenin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 04:32:27 PDT 2021


danlark marked 2 inline comments as done.
danlark added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2137
+          V == GEP->getPointerOperand() &&
+          isGEPKnownNonNull(GEP, Depth + 1, Q)) {
+        unsigned GEPUsesExplored = 0;
----------------
danlark wrote:
> lebedev.ri wrote:
> > danlark wrote:
> > > lebedev.ri wrote:
> > > > Doesn't this cause endless recursion back into `isKnownNonNullFromDominatingCondition()`
> > > > for the very same value we've started with?
> > > > (and we happen to not deadloop just because of depth cutoff)
> > > > 
> > > isKnownNonZero has Depth cutoff before isKnownNonNullFromDominatingCondition
> > > 
> > > https://github.com/llvm/llvm-project/blob/e38ccb729b205b076356684e055efb7dfc673963/llvm/lib/Analysis/ValueTracking.cpp#L2304-L2336
> > Sure, but before that cutoff triggers, won't we waste time mutually recursing with no progress?
> Not to compute the same values we may not go recursively and only look for constants, I believe this is the most popular case
Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102550



More information about the llvm-commits mailing list