[PATCH] D127398: [InstCombine] add vector support for (A >> C) == (B >> C) --> (A^B) u< (1 << C)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 17 07:12:22 PDT 2022
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - see inline for some possible minor improvements.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4608
// (A >> C) == (B >> C) --> (A^B) u< (1 << C)
// For lshr and ashr pairs.
----------------
"C" in the result is not the same as "C" in the source - update this comment to make the transform clearer?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4629
// (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0
if (match(Op0, m_OneUse(m_Shl(m_Value(A), m_ConstantInt(Cst1)))) &&
match(Op1, m_OneUse(m_Shl(m_Value(B), m_Specific(Cst1))))) {
----------------
Do you plan to change this one too? It will be easier to read the code and see the early return if we make a smaller helper function to handle the related patterns.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4646
if (Op0->hasOneUse() &&
match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A), m_ConstantInt(ShAmt))))) &&
match(Op1, m_ConstantInt(Cst1)) &&
----------------
Another transform that can be updated...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127398/new/
https://reviews.llvm.org/D127398
More information about the llvm-commits
mailing list