[PATCH] D159056: [InstCombine] Make `isFreeToInvert` check recursively.

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 08:29:33 PDT 2023


Allen added inline comments.


================
Comment at: llvm/include/llvm/Transforms/InstCombine/InstCombiner.h:273
+    Value *A, *B;
+    // Selects/min/max with invertible operands are freely invertible
+    if (match(V, m_Select(PatternMatch::m_Value(), PatternMatch::m_Value(A),
----------------
does it make sense to restrict the condition of recursion call?  then the case **predicated_or_dominates_reduction **will not be touched.
```
+    if (match(V,
+              m_Select(PatternMatch::m_Value(), m_Not(PatternMatch::m_Value(A)),
+                       m_Not(PatternMatch::m_Value(B)))) ||
+        match(V, m_MaxOrMin(m_Not(PatternMatch::m_Value(A)),
+                            m_Not(PatternMatch::m_Value(B)))))
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159056



More information about the llvm-commits mailing list