[PATCH] D133919: [InstCombine] Fold ((x?1:4)&(y?1:4))==0 to x^y

Marc Auberer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 11:30:11 PDT 2022


marcauberer marked 3 inline comments as done.
marcauberer added a comment.

As of tomorrow I am on vacation for about two weeks. I hope we can put this on hold until I am available again ...



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:6480
+    // (icmp eq (and (select A, C, D), (select B, C, D)), 0) --> (xor A, B)
+    if (I.getPredicate() == ICmpInst::ICMP_EQ && match(Op0,
+      m_c_And(
----------------
spatel wrote:
> The formatting is off.
That is on purpose to maintain overwiew ...
Will format the change later on


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:6481-6483
+      m_c_And(
+        m_Select(m_Value(A), m_Value(C), m_Value(D)),
+        m_Select(m_Value(B), m_Deferred(C), m_Deferred(D))
----------------
spatel wrote:
> This shouldn't use the commutative matcher (m_c_And); it should be m_And() with m_Specific(). 
> Ie, we match operand 0 of the 'and' as any select; then, we match operand 1 with constraints based on whatever was matched as operand 0.
Yes, indeed. Changed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133919



More information about the llvm-commits mailing list