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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 10:03:16 PDT 2019


lebedev.ri marked an inline comment as done.
lebedev.ri 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);
----------------
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.


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

https://reviews.llvm.org/D64285





More information about the llvm-commits mailing list