[InstCombine] fold shift-of-srem-by-2 to mask+shift
authorSanjay Patel <spatel@rotateright.com>
Tue, 20 Apr 2021 20:56:34 +0000 (16:56 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 20 Apr 2021 21:10:16 +0000 (17:10 -0400)
commit1e202e8f393a8bf8a9066482e66ffe2135dde9bf
treeb8ac4f84bb56f3cb97cbc768b87e8b42273be767
parenta2099d6542b978ae7c604e7d3012f9f00054a859
[InstCombine] fold shift-of-srem-by-2 to mask+shift

There are several potential srem-by-2 folds
because the result is known {-1,0,1}.

https://alive2.llvm.org/ce/z/LuVyeK
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/lshr.ll