[PATCH] D143883: [InstCombine] canonicalize urem as cmp+select
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 04:26:24 PST 2023
Allen marked 2 inline comments as done.
Allen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1791
+ // Value *X;
+ if (match(Op0, m_NUWAdd(m_Value(X), m_One())) &&
+ simplifyICmpWithDominatingAssume(ICmpInst::ICMP_ULT, X, Op1, SQ, &I)) {
----------------
nikic wrote:
> Why the nuw requirement? Seems to be fine without it? https://alive2.llvm.org/ce/z/uo7HMz
Thanks, Both of them are added in test cases.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1792
+ if (match(Op0, m_NUWAdd(m_Value(X), m_One())) &&
+ simplifyICmpWithDominatingAssume(ICmpInst::ICMP_ULT, X, Op1, SQ, &I)) {
+ Value *Cmp = Builder.CreateICmpEQ(Op0, Op1);
----------------
nikic wrote:
> Why is this specific to assumes? Can we do a generic simplifyICmp? (If we do so, Op0 needs to be frozen.)
Apply your comment, thanks
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143883/new/
https://reviews.llvm.org/D143883
More information about the llvm-commits
mailing list