Issue 147176
Summary [InstCombine] Unprofitable transformation
Labels llvm:instcombine, missed-optimization
Assignees
Reporter nikic
    https://llvm.godbolt.org/z/PP1q1hTYE
```llvm
define i8 @src(i8 noundef %_23) {
  %_17 = lshr i8 %_23, 4
  %_18 = and i8 %_23, 15
  %_16 = add nuw nsw i8 %_17, %_18
  ret i8 %_16
}
define i8 @tgt(i8 noundef %_23) {
  %_17 = lshr i8 %_23, 4
  %1 = mul i8 %_17, -15
  %_16 = add i8 %1, %_23
  ret i8 %_16
}
```
This goes against our usual guideline to avoid introducing mul out of thin air, and also increases the length of the dependence chain.

From: https://github.com/rust-lang/rust/issues/143513
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to