[PATCH] D139598: [InstCombine] Fold (X << Z) / (X * Y) -> (1 << Z) / Y
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 09:34:15 PST 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1057
+ // (X << Z) / (X * Y) -> (1 << Z) / Y
+ if (!IsSigned && Op0->hasOneUse() && Op1->hasOneUse() &&
+ match(Op0, m_NUWShl(m_Value(X), m_Value(Z))) &&
----------------
Do you plan to handle the signed case too?
I'm not sure exactly what no-wrap is required, but there is some combination that works, so add a TODO comment:
https://alive2.llvm.org/ce/z/WrXmth
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139598/new/
https://reviews.llvm.org/D139598
More information about the llvm-commits
mailing list