[PATCH] D145846: [InstCombine] enhance icmp with sub folds
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 02:12:17 PDT 2023
Allen added a comment.
https://github.com/llvm/llvm-project/issues/60818
In D145846#4266860 <https://reviews.llvm.org/D145846#4266860>, @bcl5980 wrote:
> How about this pattern ?
> https://alive2.llvm.org/ce/z/Y-Po8g
> Also reduce one usage but it works for any minuend.
Yes, I think this case is similar, but it seems the llvm doesn't have the issue end-to-end for C source, https://godbolt.org/z/EYMo9bd9c.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4096
+ if (match(&I, m_c_ICmp(Pred, m_OneUse(m_Neg(m_Value(X))), m_Deferred(X))) &&
+ (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_EQ)) {
+ Type *Ty = X->getType();
----------------
nikic wrote:
> nikic wrote:
> > Use `ICmpInst::isEquality()`.
> isEquality() means "EQ" or "NE". You don't need to check for ICMP_NE separately.
Apply your comment, thanks
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145846/new/
https://reviews.llvm.org/D145846
More information about the llvm-commits
mailing list