[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
Mon Jul 8 23:31:38 PDT 2019


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

Thanks for working on this!

In D64285#1572351 <https://reviews.llvm.org/D64285#1572351>, @spatel wrote:

> If this transform always returns an existing value, it can go in InstSimplify. Please pre-commit the baseline tests (in the InstSimplify directory and change the RUN line if I got that right).


I agree.

In D64285#1572368 <https://reviews.llvm.org/D64285#1572368>, @craig.topper wrote:

> What is one of the shifts has the "exact" flag set and the other doesn't?


We'd still drop one of two shifts, and a select, so this is really good.
But indeed. We can do this in InstSimplify only if both of the shifts either had or had no `exact`:
https://rise4fun.com/Alive/t4Z
https://rise4fun.com/Alive/P6a
https://rise4fun.com/Alive/gfP9


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

https://reviews.llvm.org/D64285





More information about the llvm-commits mailing list