[llvm] [GlobalIsel] Visit ICmp (PR #105991)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 08:19:41 PDT 2024


tschuett wrote:

simplifyFCmpInst uses the predicate and analysis to combine fcmps:
```
if (Pred == FCmpInst::FCMP_ORD || Pred == FCmpInst::FCMP_UNO) {
    KnownFPClass RHSClass =
        computeKnownFPClass(RHS, fcAllFlags, /*Depth=*/0, Q);
    KnownFPClass LHSClass =
        computeKnownFPClass(LHS, fcAllFlags, /*Depth=*/0, Q);

    if (FMF.noNaNs() ||
        (RHSClass.isKnownNeverNaN() && LHSClass.isKnownNeverNaN()))
      return ConstantInt::get(RetTy, Pred == FCmpInst::FCMP_ORD);

    if (RHSClass.isKnownAlwaysNaN() || LHSClass.isKnownAlwaysNaN())
      return ConstantInt::get(RetTy, Pred == CmpInst::FCMP_UNO);
 }
```
It is hard for me to put these combines into precise MIR patterns.

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


More information about the llvm-commits mailing list