[PATCH] D150091: [InstCombine] Transform `icmp eq/ne ({su}div exact X,Y),C` -> `icmp eq/ne X, Y*C`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 00:37:53 PDT 2023


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3305-3306
+      // div exact X, Y eq/ne C ->
+      //    if Y * C overflows:
+      //      -> eq/ne -> false/true
+      //    if Y * C never-overflow && OneUse:
----------------
Drop this part of the comment, it does not reflect the implementation.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3313
+        return new ICmpInst(Pred, BOp0, BOp1);
+      else {
+        OverflowResult OR = computeOverflow(
----------------
Check hasOneUse() first here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150091/new/

https://reviews.llvm.org/D150091



More information about the llvm-commits mailing list