[PATCH] D94301: [NFC] Remove min/max functions from InstructionCost

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 06:16:53 PST 2021


david-arm created this revision.
david-arm added reviewers: sdesmalen, ctetreau.
Herald added subscribers: dexonsmith, hiraditya.
david-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Removed the InstructionCost::min/max functions because it's
fine to use std::min/max instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94301

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


Index: llvm/unittests/Support/InstructionCostTest.cpp
===================================================================
--- llvm/unittests/Support/InstructionCostTest.cpp
+++ llvm/unittests/Support/InstructionCostTest.cpp
@@ -59,6 +59,6 @@
   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);
 }
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -6296,7 +6296,7 @@
         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: llvm/include/llvm/Support/InstructionCost.h
===================================================================
--- llvm/include/llvm/Support/InstructionCost.h
+++ llvm/include/llvm/Support/InstructionCost.h
@@ -196,14 +196,6 @@
     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;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94301.315372.patch
Type: text/x-patch
Size: 1592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210108/5ce62047/attachment.bin>


More information about the llvm-commits mailing list