[llvm] e50aa1a - [NARY][NFC] Use hasNUsesOrMore instead of getNumUses since it's more
Evgeniy Brevnov via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 12 19:30:03 PDT 2021
Author: Evgeniy Brevnov
Date: 2021-04-13T09:29:49+07:00
New Revision: e50aa1af2d3b8c8d428734bb1752ec45bcc0eb33
URL: https://github.com/llvm/llvm-project/commit/e50aa1af2d3b8c8d428734bb1752ec45bcc0eb33
DIFF: https://github.com/llvm/llvm-project/commit/e50aa1af2d3b8c8d428734bb1752ec45bcc0eb33.diff
LOG: [NARY][NFC] Use hasNUsesOrMore instead of getNumUses since it's more
efficient.
Added:
Modified:
llvm/lib/Transforms/Scalar/NaryReassociate.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
index e352bfd0b4e2..2284142c8aa1 100644
--- a/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/NaryReassociate.cpp
@@ -592,7 +592,7 @@ Value *NaryReassociatePass::tryReassociateMinOrMax(Instruction *I,
Value *A = nullptr, *B = nullptr;
MaxMinT m_MaxMin(m_Value(A), m_Value(B));
for (unsigned int i = 0; i < 2; ++i) {
- if (LHS->getNumUses() <= 2 && match(LHS, m_MaxMin)) {
+ if (!LHS->hasNUsesOrMore(3) && match(LHS, m_MaxMin)) {
const SCEV *AExpr = SE->getSCEV(A), *BExpr = SE->getSCEV(B);
const SCEV *RHSExpr = SE->getSCEV(RHS);
for (unsigned int j = 0; j < 2; ++j) {
More information about the llvm-commits
mailing list