Issue |
132908
|
Summary |
Missed Optimizeation: Missed Optimization: Consecutive divisions can be merged into one if intermediate multiplication doesn't overflow.
|
Labels |
new issue
|
Assignees |
|
Reporter |
MaxGraey
|
I'm wondering why `computeOverflowForUnsignedMul` can't pass this scenario:
Alive2 proof: https://alive2.llvm.org/ce/z/AYcyYF
```llvm
define noundef i8 @src(i8 noundef %a, i8 noundef %b, i8 noundef %c) {
start:
;; assume b < sqrt(max)
%b_less_than_sqrt_max = icmp ult i8 %b, 15
tail call void @llvm.assume(i1 %b_less_than_sqrt_max)
;; assume c < sqrt(max)
%c_less_than_sqrt_max = icmp ult i8 %c, 15
tail call void @llvm.assume(i1 %c_less_than_sqrt_max)
;; perform a / b / c
%div_ab = udiv i8 %a, %b
%res = udiv i8 %div_ab, %c
ret i8 %res
}
```
```llvm
define noundef i8 @tgt(i8 noundef %a, i8 noundef %b, i8 noundef %c) {
start:
;; perform a / (b * c)
%mul_cb = mul nuw i8 %c, %b
%res = udiv i8 %a, %mul_cb
ret i8 %res
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs