[PATCH] D140798: [InstCombine] Fold zero check followed by decrement to usub.sat

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 02:43:44 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:816-836
+  // (a == 0) : 0 : a - 1 -> usub.sat(a, 1)
+  if (ICmpInst::isEquality(Pred)) {
+    if (!match(B, m_Zero()))
+      return nullptr;
+
+    if (match(FalseVal, m_Zero())) {
+      if (Pred == ICmpInst::ICMP_NE) {
----------------
I believe this should be sufficient now. The rest is handled by the shared bit of code.


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

https://reviews.llvm.org/D140798



More information about the llvm-commits mailing list