Issue 131444
Summary [InstCombine] Infer exact for lshr by cttz
Labels llvm:instcombine, missed-optimization
Assignees
Reporter nikic
    From https://github.com/rust-lang/rust/issues/138497:

```llvm
define i8 @src(i8 %x) {
  %cttz = call i8 @llvm.cttz.i8(i8 %x, i1 false)
  %lshr = lshr i8 %x, %cttz
  ret i8 %lshr
}

define i8 @tgt(i8 %x) {
  %cttz = call i8 @llvm.cttz.i8(i8 %x, i1 false)
  %lshr = lshr exact i8 %x, %cttz
 ret i8 %lshr
}
```
https://alive2.llvm.org/ce/z/KFemjy

This then allows folding `icmp eq %lshr, 0`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to