[PATCH] D152673: [InstCombine] Canonicalize `(X^(X-1)) u{ge, lt} X` as pow2 test

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 11:58:00 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:4834
+  }
+  else if(Pred == ICmpInst::ICMP_UGE || Pred == ICmpInst::ICMP_ULT) {
+    // (A ^ (A-1)) u>= A --> ctpop(A) < 2 (two commuted variants)
----------------
format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152673



More information about the llvm-commits mailing list