[PATCH] D109151: [InstCombine] Convert xor (ashr X, BW-1), C -> select(X >=s 0, C, ~C)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 7 00:24:01 PDT 2021


foad added a comment.

> isn't the main pattern here: https://alive2.llvm.org/ce/z/B8TUY6 ?

This is (trunc (ashr i16 %input, 15) to i8) -> (select i1 (icmp sgt i16 %input, 65535), i8 0, i8 255), but I don't understand why you include the trunc in the transformation.

Don't we want to fold (ashr i16 %input, 15) -> (select i1 (icmp sgt i16 %input, 65535), i16 0, i16 65535) in //any// situation where the user(s) of this expression can be pushed into the select? I.e. not just a trunc, but also things like an XOR with constant from the original motivating example "xor (ashr X, BW-1), C".


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

https://reviews.llvm.org/D109151



More information about the llvm-commits mailing list