[llvm] [InstCombine] Optimize redundant floating point comparisons in `or` inst (PR #158097)
Hongyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 13 01:50:08 PDT 2025
================
@@ -1850,6 +1850,26 @@ static Value *simplifyAndOrOfFCmps(const SimplifyQuery &Q, FCmpInst *LHS,
: ConstantInt::getBool(LHS->getType(), !IsAnd);
}
+ Value *V0;
+ const APFloat *V0Op1, *V1Op1;
+ if (match(LHS, m_SpecificFCmp(FCmpInst::FCMP_OLT, m_Value(V0),
+ m_APFloat(V0Op1))) &&
+ match(RHS, m_SpecificFCmp(FCmpInst::FCMP_OLT, m_Specific(V0),
+ m_APFloat(V1Op1)))) {
+ if (V0Op1 > V1Op1)
+ return static_cast<Value *>(LHS);
----------------
XChy wrote:
```suggestion
return LHS;
```
https://github.com/llvm/llvm-project/pull/158097
More information about the llvm-commits
mailing list