[llvm] Minor optimaze in visitFcmp (PR #156097)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 29 13:21:08 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: None (Seraphimt)
<details>
<summary>Changes</summary>
Studying the code related to float found a slightly optimal sequence of actions.
---
Full diff: https://github.com/llvm/llvm-project/pull/156097.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+3-3)
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 3a8e043038153..90feddf6dcfe1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -8944,14 +8944,14 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
}
{
- Value *CanonLHS = nullptr, *CanonRHS = nullptr;
+ Value *CanonLHS = nullptr;
match(Op0, m_Intrinsic<Intrinsic::canonicalize>(m_Value(CanonLHS)));
- match(Op1, m_Intrinsic<Intrinsic::canonicalize>(m_Value(CanonRHS)));
-
// (canonicalize(x) == x) => (x == x)
if (CanonLHS == Op1)
return new FCmpInst(Pred, Op1, Op1, "", &I);
+ Value *CanonRHS = nullptr;
+ match(Op1, m_Intrinsic<Intrinsic::canonicalize>(m_Value(CanonRHS)));
// (x == canonicalize(x)) => (x == x)
if (CanonRHS == Op0)
return new FCmpInst(Pred, Op0, Op0, "", &I);
``````````
</details>
https://github.com/llvm/llvm-project/pull/156097
More information about the llvm-commits
mailing list