[llvm-branch-commits] [llvm] d4a999b - [SLP] reduce code duplication; NFC

Sanjay Patel via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 5 12:32:09 PST 2021


Author: Sanjay Patel
Date: 2021-01-05T15:12:40-05:00
New Revision: d4a999b453a4d3cfeee02f00f4900327fc7fcede

URL: https://github.com/llvm/llvm-project/commit/d4a999b453a4d3cfeee02f00f4900327fc7fcede
DIFF: https://github.com/llvm/llvm-project/commit/d4a999b453a4d3cfeee02f00f4900327fc7fcede.diff

LOG: [SLP] reduce code duplication; NFC

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 8965a44ffd2b..390b71e7a46b 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7137,8 +7137,9 @@ class HorizontalReduction {
     Type *ScalarTy = FirstReducedVal->getType();
     auto *VecTy = FixedVectorType::get(ScalarTy, ReduxWidth);
 
+    RecurKind Kind = RdxTreeInst.getKind();
     int SplittingRdxCost;
-    switch (RdxTreeInst.getKind()) {
+    switch (Kind) {
     case RecurKind::Add:
     case RecurKind::Mul:
     case RecurKind::Or:
@@ -7155,7 +7156,6 @@ class HorizontalReduction {
     case RecurKind::UMax:
     case RecurKind::UMin: {
       auto *VecCondTy = cast<VectorType>(CmpInst::makeCmpResultType(VecTy));
-      RecurKind Kind = RdxTreeInst.getKind();
       bool IsUnsigned = Kind == RecurKind::UMax || Kind == RecurKind::UMin;
       SplittingRdxCost =
           TTI->getMinMaxReductionCost(VecTy, VecCondTy,
@@ -7167,7 +7167,7 @@ class HorizontalReduction {
     }
 
     int ScalarReduxCost = 0;
-    switch (RdxTreeInst.getKind()) {
+    switch (Kind) {
     case RecurKind::Add:
     case RecurKind::Mul:
     case RecurKind::Or:


        


More information about the llvm-branch-commits mailing list