| Issue |
58110
|
| Summary |
[DAG] Failure to reassociate SMAX/SMIN/UMAX/UMIN
|
| Labels |
good first issue,
llvm:codegen,
missed-optimization
|
| Assignees |
|
| Reporter |
RKSimon
|
While opt will reassociate IMINMAX intrinsics, if they appear later in DAG we fail to handle them:
```
declare i32 @llvm.umin.i32(i32, i32)
define i32 @foo(i32 %x) {
%a = call i32 @llvm.umin.i32(i32 %x, i32 17)
%b = call i32 @llvm.umin.i32(i32 %a, i32 17)
ret i32 %b
}
```
llc -mtriple=x86_64--
```
foo: # @foo
cmpl $17, %edi
movl $17, %eax
cmovael %eax, %edi
cmpl $17, %edi
cmovbl %edi, %eax
retq
```
Godbolt: https://gcc.godbolt.org/z/45sYa7xj1
This is mainly about adding test coverage - the actual code change to add a reassociateOps call to visitIMINMAX is trivial
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs