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

Think it may be worth it to handle `sext` as well. X86 vec compare intrinsics 
for example expand to `(sext (icmp))`

Think logic is just about exactly the same but the `C->isOne()` case becomes: 
`isZext ? C->isOne() : C->isAllOnes()`

https://github.com/llvm/llvm-project/pull/65852
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to