[PATCH] D64285: [InstSimplify] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 09:47:57 PDT 2019


xbolva00 marked an inline comment as done.
xbolva00 added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:82-85
+  if ((Pred == ICmpInst::ICMP_SGT && match(CmpRHS, m_AllOnes())) ||
+      (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, m_One()))) {
+    if (Pred == ICmpInst::ICMP_SLT)
+      std::swap(TrueVal, FalseVal);
----------------
lebedev.ri wrote:
> There was some utility function to check for sign-bit tests, i think, i can't find it..
Thanks for hint!

I found it, decomposeBitTestICmp.


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

https://reviews.llvm.org/D64285





More information about the llvm-commits mailing list