[llvm-branch-commits] [llvm] b7ccaca - [NFC] Remove min/max functions from InstructionCost
David Sherwood via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 11 01:05:17 PST 2021
Author: David Sherwood
Date: 2021-01-11T09:00:12Z
New Revision: b7ccaca53700fce21b0e8e5d7bd2a956bd391fee
URL: https://github.com/llvm/llvm-project/commit/b7ccaca53700fce21b0e8e5d7bd2a956bd391fee
DIFF: https://github.com/llvm/llvm-project/commit/b7ccaca53700fce21b0e8e5d7bd2a956bd391fee.diff
LOG: [NFC] Remove min/max functions from InstructionCost
Removed the InstructionCost::min/max functions because it's
fine to use std::min/max instead.
Differential Revision: https://reviews.llvm.org/D94301
Added:
Modified:
llvm/include/llvm/Support/InstructionCost.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/unittests/Support/InstructionCostTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h
index fe56d49b4174..725f8495ac09 100644
--- a/llvm/include/llvm/Support/InstructionCost.h
+++ b/llvm/include/llvm/Support/InstructionCost.h
@@ -196,14 +196,6 @@ class InstructionCost {
return *this >= RHS2;
}
- static InstructionCost min(InstructionCost LHS, InstructionCost RHS) {
- return LHS < RHS ? LHS : RHS;
- }
-
- static InstructionCost max(InstructionCost LHS, InstructionCost RHS) {
- return LHS > RHS ? LHS : RHS;
- }
-
void print(raw_ostream &OS) const;
};
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 5b91495bd844..bd673d112b3a 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -6305,7 +6305,7 @@ bool SLPVectorizerPass::tryToVectorizeList(ArrayRef<Value *> VL, BoUpSLP &R,
Cost -= UserCost;
}
- MinCost = InstructionCost::min(MinCost, Cost);
+ MinCost = std::min(MinCost, Cost);
if (Cost.isValid() && Cost < -SLPCostThreshold) {
LLVM_DEBUG(dbgs() << "SLP: Vectorizing list at cost:" << Cost << ".\n");
diff --git a/llvm/unittests/Support/InstructionCostTest.cpp b/llvm/unittests/Support/InstructionCostTest.cpp
index da3d3f47a212..8ba9f990f027 100644
--- a/llvm/unittests/Support/InstructionCostTest.cpp
+++ b/llvm/unittests/Support/InstructionCostTest.cpp
@@ -59,6 +59,6 @@ TEST_F(CostTest, Operators) {
EXPECT_EQ(*(VThree.getValue()), 3);
EXPECT_EQ(IThreeA.getValue(), None);
- EXPECT_EQ(InstructionCost::min(VThree, VNegTwo), -2);
- EXPECT_EQ(InstructionCost::max(VThree, VSix), 6);
+ EXPECT_EQ(std::min(VThree, VNegTwo), -2);
+ EXPECT_EQ(std::max(VThree, VSix), 6);
}
More information about the llvm-branch-commits
mailing list