[NFC] Remove min/max functions from InstructionCost
authorDavid Sherwood <david.sherwood@arm.com>
Thu, 7 Jan 2021 15:02:50 +0000 (15:02 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Mon, 11 Jan 2021 09:00:12 +0000 (09:00 +0000)
Removed the InstructionCost::min/max functions because it's
fine to use std::min/max instead.

Differential Revision: https://reviews.llvm.org/D94301

llvm/include/llvm/Support/InstructionCost.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/unittests/Support/InstructionCostTest.cpp

index fe56d49..725f849 100644 (file)
@@ -196,14 +196,6 @@ public:
     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;
 };
 
index 5b91495..bd673d1 100644 (file)
@@ -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");
index da3d3f4..8ba9f99 100644 (file)
@@ -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);
 }