[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 11:26:13 PDT 2019


xbolva00 marked 2 inline comments 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:
> xbolva00 wrote:
> > 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.
> Yep, i think that's the one.
Sadly, we cannot use it here. E.g.: slt x, 1


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

https://reviews.llvm.org/D64285





More information about the llvm-commits mailing list