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

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 3 01:02:50 PST 2024


================
@@ -580,6 +580,43 @@ static bool cmpExcludesZero(CmpInst::Predicate Pred, const Value *RHS) {
   return true;
 }
 
+static void breakSelfRecursivePHI(const Use *U, const PHINode *PHI,
+                                  Value *&ValOut, Instruction *&CtxIOut,
+                                  unsigned *DepthInOut = nullptr) {
+  ValOut = U->get();
+  if (ValOut == PHI)
+    return;
+  CtxIOut = PHI->getIncomingBlock(*U)->getTerminator();
+  Value *V;
+  // If the Use is a select of this phi, compute analysis on other arm to be
+  // recusion.
----------------
tschuett wrote:

recursion?

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


More information about the llvm-commits mailing list