[PATCH] D146196: [InstSimplify] make simplifyUnsignedRangeCheck commutative for ZeroICmp

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 01:31:26 PDT 2023


nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.

InstCombine canonicalizes constant icmp operands to the RHS, this is why constants are not usually handled on the LHS. Unless there is some PhaseOrdering reason why it is important to handle this pattern prior to the first InstCombine run, we shouldn't do this.



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1564
+  if (!(match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) ||
+        match(ZeroICmp, m_ICmp(EqPred, m_Zero(), m_Value(Y)))) ||
       !ICmpInst::isEquality(EqPred))
----------------
You can use `m_c_ICmp`.


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

https://reviews.llvm.org/D146196



More information about the llvm-commits mailing list