[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 13:45:47 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2613
 
+  if (Value *V = foldOrOfCtpop(LHS, RHS, Builder))
+    return V;
----------------
Should we also handle the opposite version `ctpop(x) != 1 && x != 0`?


================
Comment at: llvm/test/Transforms/InstCombine/icmp-or.ll:399
+  ret i1 %5
+}
----------------
Can you add a vector test as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077



More information about the llvm-commits mailing list