[PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 3 08:28:57 PDT 2021


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

In D109149#2982417 <https://reviews.llvm.org/D109149#2982417>, @dmgreen wrote:

> I've added oneusecmp tests, which show the same number or less instructions for the cases I've tested. let me know if I should add a oneuse check in case other patterns are not better.

Bit hack looks slightly better to me too, so LGTM. 
The safe move would be to put the one-use clause into a first commit, then remove it as a follow-up, so we just get the more aggressive folds on their own. That also makes it less likely that we'd have to revert the main patch if only the more aggressive case causes a regression somewhere.


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

https://reviews.llvm.org/D109149



More information about the llvm-commits mailing list