[Mlir-commits] [mlir] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)

Yingwei Zheng llvmlistbot at llvm.org
Sun Oct 1 04:29:03 PDT 2023


================
@@ -6380,7 +6380,71 @@ Instruction *InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
       Y->getType()->isIntOrIntVectorTy(1) && Pred == ICmpInst::ICMP_ULE)
     return BinaryOperator::CreateOr(Builder.CreateIsNull(X), Y);
 
+  // icmp eq/ne X, (zext/sext (icmp eq/ne X, C))
+  ICmpInst::Predicate Pred1, Pred2;
   const APInt *C;
+  Instruction *ExtI;
+  if (match(&I, m_c_ICmp(Pred1, m_Value(X),
+                         m_CombineAnd(m_Instruction(ExtI),
+                                      m_ZExtOrSExt(m_ICmp(Pred2, m_Deferred(X),
+                                                          m_APInt(C))))))) {
----------------
dtcxzyw wrote:

Sorry, I accidentally dropped the checks in 70a70fb44d0e628a1cf485e1767ada3eaaa26b0f.

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


More information about the Mlir-commits mailing list