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

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 19:29:36 PST 2022


Chenbing.Zheng marked 2 inline comments as done.
Chenbing.Zheng added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1062
+      return BinaryOperator::CreateUDiv(
+          Builder.CreateShl(ConstantInt::get(Ty, 1), Z), Y);
+  }
----------------
RKSimon wrote:
> arsenm wrote:
> > Can you preserve NUW and exact?
> Move the !IsSigned check outside to avoid the cost of match calls?
I preserve exact, but it seems that NUW is unnecessary when Op0 of SHL is 1 ?


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