[InstCombine] Transform (icmp eq/ne rotate(X,AX),rotate(Y,AY)) -> (icmp eq/ne rotate...
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 7 Jun 2023 17:42:22 +0000 (12:42 -0500)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Sat, 10 Jun 2023 19:38:46 +0000 (14:38 -0500)
commit2df6309555963fb9411ed8023a8e585f7981b3bf
treefa2295d49c72ca2b82554147c911f543ed5e00b2
parent1ce0265230c0810589fabdaed7150f4fb737b34f
[InstCombine] Transform (icmp eq/ne rotate(X,AX),rotate(Y,AY)) -> (icmp eq/ne rotate(Y,AX-AY))

Only do so if we don't create more instructions, so either both
rotates have one use or one of the rotates has one use and both `AX`
and `AY` are constant.
Proof: https://alive2.llvm.org/ce/z/rVmJgz

Differential Revision: https://reviews.llvm.org/D152348
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-equality-rotate.ll
llvm/test/Transforms/InstCombine/icmp-rotate.ll