[PATCH] D144610: [InstCombine] Add transforms for `(icmp upred (or X, Y), X)`
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 02:08:32 PDT 2023
foad added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4444
+
+ if (!match(Op0, m_c_Or(m_Specific(Op1), m_Value(A))))
+ return nullptr;
----------------
"else if" to avoid doing the match twice if we swapped?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4452
+ // icmp (X | Y) u> X --> (X | Y) != X
+ else if (Pred == ICmpInst::ICMP_UGT)
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
----------------
No "else" after "return"
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4465
+ // icmp (X | Y) eq/ne Y --> (~X | Y) eq/ne -1 if X is freely invertible.
+ if (IsFreelyInvertible(A))
+ return new ICmpInst(Pred,
----------------
The comments say "X" but the code says "A". Can you change one or the other so they match?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144610/new/
https://reviews.llvm.org/D144610
More information about the llvm-commits
mailing list