Issue 90020
Summary [InstCombine] Failure to infer nuw for mul nsw of non-negative
Labels llvm:instcombine, missed-optimization
Assignees nikic
Reporter nikic
    We currently fail to infer mul nuw if we have mul nsw and the operands are non-negative.

https://alive2.llvm.org/ce/z/2Dz9Uu
```llvm
define i8 @src(i8 %x, i8 %y) {
  %x.nneg = icmp sge i8 %x, 0
  call void @llvm.assume(i1 %x.nneg)
  %y.nneg = icmp sge i8 %y, 0
  call void @llvm.assume(i1 %y.nneg)
  %mul = mul nsw i8 %x, %y
  ret i8 %mul
}

define i8 @tgt(i8 %x, i8 %y) {
  %mul = mul nuw i8 %x, %y
  ret i8 %mul
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to