[PATCH] D123748: [ValueTracking] Added support to deduce PHI Nodes values being a power of 2

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 14:58:02 PDT 2022


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


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2173
+  if (const PHINode *PN = dyn_cast<PHINode>(V)) {
+    unsigned NewDepth = std::max(Depth, MaxAnalysisRecursionDepth - 1);
+    Query RecQ = Q;
----------------
spatel wrote:
> Carrot wrote:
> > Please add a comment here. I searched the source code for a while to understand its purpose.
> This request was not answered. We are using max depth to avoid a compile-time explosion because we are recursing on every phi operand?
Looks like it should be just Depth instead, will fix it. 

A similar appearance in line 2580 (isKnownNonZero)  may be a bug then? This limits the level of recursion to be 2, instead of MaxAnalysisRecursionDepth. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123748



More information about the llvm-commits mailing list