[PATCH] D156238: [InstCombine] Generalize foldICmpWithMinMax

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 07:41:20 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4976
+  if (ICmpInst::isSigned(Pred) && (MinMaxIntrinsic == Intrinsic::umin ||
+                                   MinMaxIntrinsic == Intrinsic::umax))
     return nullptr;
----------------
You can use `MinMaxIntrinsic::isSigned(MinMaxIntrinsic)`.

Or maybe cleaner, you can pass in in the `MinMaxIntrinsic` and then do things like `II->isSigned()`.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5031
+    auto FoldIntoConstant = [&](bool Value) {
+      return replaceInstUsesWith(I, Builder.getInt1(Value));
+    };
----------------
Please add some vector tests. This looks like it will break with vector icmp.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156238



More information about the llvm-commits mailing list