[InstCombine] ror/rol(X, RotAmt) == C --> X == rol/ror(C, RotAmt) (PR51567)
authorDávid Bolvanský <david.bolvansky@gmail.com>
Tue, 7 Sep 2021 16:04:38 +0000 (18:04 +0200)
committerDávid Bolvanský <david.bolvansky@gmail.com>
Tue, 7 Sep 2021 16:04:58 +0000 (18:04 +0200)
commit3b5f318f5d2df423afd3b5dddd824fc9a66db17b
treee1d6ebb8ff15d7259cc9d12e5ef173240c5d8ead
parent81d3ac0cf2cb4b356843c74ccf5641fb5eb362fe
[InstCombine] ror/rol(X, RotAmt) == C --> X == rol/ror(C, RotAmt)   (PR51567)

```
----------------------------------------
define i1 @src(i32 %0) {
%1:
  %2 = fshl i32 %0, i32 %0, i32 25
  %3 = icmp eq i32 %2, 5
  ret i1 %3
}
=>
define i1 @tgt(i32 %0) {
%1:
  %2 = icmp eq i32 %0, 640
  ret i1 %2
}
Transformation seems to be correct!
```

https://alive2.llvm.org/ce/z/GdY8Jm

Solves PR51567

Reviewed By: spatel

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