[PATCH] D149195: [SelectionDAG] Limit max recursion in `isKnownNeverZero` and `isKnownToBeAPowerOfTwo`

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 03:41:34 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3979
+bool SelectionDAG::isKnownToBeAPowerOfTwo(SDValue Val, unsigned Depth) const {
+  if (Depth++ >= MaxRecursionDepth)
+    return false; // Limit search depth.
----------------
In the existing SelectionDAG recursion methods, we don't increment Depth here but in the recursive calls to make it more obvious (and avoids any messy Depth - 1 hacks)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149195



More information about the llvm-commits mailing list