[PATCH] D139598: [InstCombine] Fold (X << Z) / (X * Y) -> (1 << Z) / Y

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 04:38:52 PST 2022


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1058
+  // TODO: Handle sdiv.
+  if (!IsSigned && Op0->hasOneUse() && Op1->hasOneUse() &&
+      match(Op0, m_NUWShl(m_Value(X), m_Value(Z))) &&
----------------
Would this still be a good transform even if the shift has another use (is there a test for that pattern)?
If we are trading a multiply for a shift, it's probably beneficial.


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