[llvm] [InstCombine] Remove redundant fptrunc of select fold (NFCI) (PR #117182)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 02:16:38 PST 2024
nikic wrote:
A complicating factor is that we perform this canonicalization:
```llvm
define float @t4(double %a) {
; CHECK-LABEL: @t4(
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp oge double [[A:%.*]], 5.000000e+00
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[DOTINV]], double 5.000000e+00, double [[A]]
; CHECK-NEXT: [[TMP2:%.*]] = fptrunc double [[TMP1]] to float
; CHECK-NEXT: ret float [[TMP2]]
;
%1 = fcmp ult double %a, 5.0
%2 = fptrunc double %a to float
%3 = select i1 %1, float %2, float 5.0
ret float %3
}
```
So just special casing fptrunc also doesn't work, because we'd infinite loop with this transform. So I'm inclined to just leave this alone...
https://github.com/llvm/llvm-project/pull/117182
More information about the llvm-commits
mailing list