| Issue |
243429
|
| Summary |
[InstCombine] missed mulh folding
|
| Labels |
llvm:instcombine,
missed-optimization
|
| Assignees |
|
| Reporter |
Andarwinux
|
https://godbolt.org/z/n4njjjaGb
found from https://github.com/lemire/fastmod/blob/master/include/fastmod.h#L165-L170
```llvm
define i64 @src(i64 %lowbits, i32 %d) {
%conv = zext i64 %lowbits to i128
%conv1 = zext i32 %d to i128
%mul = mul nuw nsw i128 %conv1, %conv
%shr = lshr i128 %mul, 64
%conv2 = trunc nuw nsw i128 %shr to i64
ret i64 %conv2
}
define i64 @tgt(i64 %lowbits, i32 %d) {
%z = zext i32 %d to i64
%m = tail call i64 @llvm.umulh.i64(i64 %lowbits, i64 %z)
ret i64 %m
}
```
```
<Compilation failed>
alive-tv - 293ms
<source>:12:22: error: unknown intrinsic 'llvm.umulh.i64'
%m = tail call i64 @llvm.umulh.i64(i64 %lowbits, i64 %z)
^
Could not read bitcode from '<source>'
Compiler returned: 255
```
Looks like alive2 doesn't support mulh intrinsic, so I can't provide a proof, but I think this should be valid.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs