[PATCH] D147597: [InstCombine] icmp(X | LHS, C) --> icmp(X, 0)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 02:38:24 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1958
+  // icmp(X | LHS, C) --> icmp(X, 0)
+  if (C.isNonNegative() && match(Or, m_OneUse(m_Or(m_Value(X), m_APInt(LHS))))) {
+    switch (Pred) {
----------------
I don't think this one-use check is necessary, as we're only creating one insturction. I believe @bcl5980's point was just to add a multi-use test, not that it needs to be restricted to one-use.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147597



More information about the llvm-commits mailing list