[llvm] [InstCombine] Optimize unneeded float to int cast when icmp (PR #155501)

Artem Trokhymchuk via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 04:29:07 PDT 2025


trokhymchuk wrote:

> @trokhymchuk Can you please provide a generalized proof? See https://llvm.org/docs/InstCombineContributorGuide.html#proofs.

generalized proofs:

* `icmp sgt (fptosi %x), <negative> -> fcmp ogt %x, <negative>`: https://alive2.llvm.org/ce/z/isTzu2
* `icmp sgt (fptosi %x), <non-negative> -> fcmp oge %x, <non-negative + 1>`: https://alive2.llvm.org/ce/z/sdZTgm
* `icmp slt (fptosi %x), <positive> -> fcmp olt %x, <positive>`: https://alive2.llvm.org/ce/z/d78YAh
* `icmp slt (fptosi %x), <non-positive> -> fcmp ole %x, <non-positive - 1>:` https://alive2.llvm.org/ce/z/kwQv2U

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


More information about the llvm-commits mailing list