[PATCH] D64285: [InstCombine] 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 11:55:34 PDT 2019


lebedev.ri added a comment.

In D64285#1576611 <https://reviews.llvm.org/D64285#1576611>, @xbolva00 wrote:

> Moved back to InstCombine.


I think we are going in circles here.
Part of this fold belongs to instsimplify: (either both are `exact`, or both non-`exact`, or ashr non-`exact`)
https://rise4fun.com/Alive/pleX
And whatever remains (only `ashr` is exact) should be folded to `ashr i32 %x, %y` in instcombine.
https://rise4fun.com/Alive/MSpl



================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:547-548
+  Value *X, *Y;
+  if ((Pred == ICmpInst::ICMP_SGT && match(CmpRHS, m_AllOnes())) ||
+      (Pred == ICmpInst::ICMP_SLT && match(CmpRHS, m_One()))) {
+    if (Pred == ICmpInst::ICMP_SLT)
----------------
Actually, i don't think this is precise: https://rise4fun.com/Alive/Njpt


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

https://reviews.llvm.org/D64285





More information about the llvm-commits mailing list