[llvm] [InstCombine] Improve `(icmp pred (and X, Y), ...)` fold. (PR #66787)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 12:22:48 PDT 2023


================
@@ -245,32 +246,38 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
     if (match(V, PatternMatch::m_AnyIntegralConstant()))
       return true;
 
+    if (Depth++ >= MaxAnalysisRecursionDepth)
----------------
goldsteinn wrote:

This is something there is no consistency across LLVM with. I know in SelectionDAG we do `Depth; Depth + 1` but somewhere like ValueTracking we use `Depth++; Depth`.

Personally I like the `Depth++` way b.c you don't have to type `Depth + 1` everywhere (easier to not mess up imo), and it seems more consistent with what a see elsewhere in InstCombine / the middle end.

Unless you feel strongly would prefer to keep as is.

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


More information about the llvm-commits mailing list