[llvm] [InstCombine] Fold `fcmp (fmul X, C1), C2` to `fcmp X, C2/C1` (PR #205003)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 28 07:00:25 PDT 2026


================

----------------
dtcxzyw wrote:

`ConstantFoldBinaryOpOperands(fdiv)` ignores inexact status. I'd suggest only handling scalars and vector splats. Then we can use the result of `APFloat::divide` to filter out inexact divisions.

I don't think Alive2 can prove the transformation within an acceptable time (half/bfloat are the smallest floating types in LLVM IR). You can write SMT expressions with a smaller number of exponent/significand bits. Then use cvc5/z3 to show that it is unsat.


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


More information about the llvm-commits mailing list