[llvm] [ValueTracking] Handle recursive select/PHI in ComputeKnownBits/IsKnownNonZero (PR #114689)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 2 22:44:42 PDT 2024


================
@@ -1580,14 +1582,22 @@ static void computeKnownBitsFromOperator(const Operator *I,
                                                : SI->getTrueValue();
             IncDepth = Depth + 1;
           }
+        } else if (auto *IncPhi = dyn_cast<PHINode>(IncValue);
----------------
dtcxzyw wrote:

We need a helper function `void breakSelfRecursion(Use &U, PHINode *PHI, Value*& ValOut, unsigned &DepthInOut, Instruction *&CtxIOut)` to avoid duplicate logic.


https://github.com/llvm/llvm-project/pull/114689


More information about the llvm-commits mailing list