[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [clang-tools-extra] [InstCombine] Simplify the pattern `a ne/eq (zext/sext (a ne/eq c))` (PR #65852)
From:       Nikita Popov via cfe-commits <cfe-commits () lists ! llvm ! org>
Date:       2023-09-30 19:42:23
Message-ID: 65187a1f.050a0220.f04c3.32d3 () mx ! google ! com
[Download RAW message or body]


================
@@ -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))))))) {
----------------
nikic wrote:

As far as I can tell, nothing here checks that Pred1 and Pred2 are equality \
predicates, so all the "else" branches below assuming that "else" is eq/ne are wrong? \
I don't see any negative tests for non-equality predicates either.

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic