[llvm] [InstCombine] Optimize redundant floating point comparisons in `or` inst (PR #158097)
Rajveer Singh Bharadwaj via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 11 08:56:11 PDT 2025
================
@@ -4514,6 +4514,30 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
if (Value *V = SimplifyAddWithRemainder(I))
return replaceInstUsesWith(I, V);
+ Value *V0, *V1;
+ const APFloat *V0Op1, *V1Op1;
+ if (match(Op0, m_SpecificFCmp(FCmpInst::FCMP_OLT, m_Value(V0),
+ m_APFloat(V0Op1))) &&
+ match(Op1, m_SpecificFCmp(FCmpInst::FCMP_OLT, m_Value(V1),
+ m_APFloat(V1Op1)))) {
+ if (V0 == V1) {
+ if (V0Op1 > V1Op1)
+ replaceInstUsesWith(I, Op0);
----------------
Rajveer100 wrote:
I believe you meant to create a method in this file itself? I don't see an existing one as such.
https://github.com/llvm/llvm-project/pull/158097
More information about the llvm-commits
mailing list