llvm-project
e0da50d0 - [InstCombine] Fold fpto[su]i of llvm.trunc (#231414)

Commit
38 days ago
[InstCombine] Fold fpto[su]i of llvm.trunc (#231414) fptoui and fptosi already round toward zero, so a preceding llvm.trunc is redundant and the conversion can take the untruncated value. NaN, infinity, and out of range inputs produce poison in both forms. ```llvm %t = call float @llvm.trunc.f32(float %x) %r = fptosi float %t to i32 --> %r = fptosi float %x to i32 ``` The trunc may have other users; only the conversion operand is replaced. Alive2 link: https://alive2.llvm.org/ce/z/HvbncV
Author
Parents
Loading