[llvm] Inst combine optimize unneded float to int cast when icmp (PR #155501)

Artem Trokhymchuk via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 12:40:38 PDT 2025


trokhymchuk wrote:

> > Looks like I also need advice: current implementation relies upon the fact that constant is **always** second argument to the `icmp` and I was unable to thwart the canonicalization, because when I used constant in the 'thwart instruction' I just got constant folded result and 'thwarting' did not change the order of operands, and I am unsure how to thwart correctly or should I support reverse order at all.
> 
> Constants for icmp are always on the right, there is no need to test them on the left. Also the thwarting bit in https://llvm.org/docs/InstCombineContributorGuide.html#id8 is actually outdated (no longer needed). I'll update the docs.

That is neat, thanks

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


More information about the llvm-commits mailing list