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

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 21:45:12 PDT 2023


bcl5980 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) {
----------------
nikic wrote:
> 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.
Yeah, what I mean is only add a test for multi-use case. We needn't restrict one-use here.


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