[llvm-branch-commits] [llvm] [InstCombine] Fold fpto[su]i.sat of NaN guarded select (PR #230188)

Harrison Hao via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Oct 12 02:04:28 PDT 2026


harrisonGPU wrote:

> fptoi.sat of select gets canonicalized to select of fptoi.sat, so that's the form you should match. I assume that what you're doing currently only happens to work because you inserted the fold before the fold that pushes the intrinsic through select.

Thanks @nikic, really appreciate it. :-) I've updated the patch to match the canonical `select(fcmp, sat(X), 0)` form and moved the fold to InstSimplify. I've also added an Alive2 proof to the PR description. To be honest, this is a corner case, so if you think it's not worth it, I'm happy to close it.

https://github.com/llvm/llvm-project/pull/230188


More information about the llvm-branch-commits mailing list