From d4a999b453a4d3cfeee02f00f4900327fc7fcede Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 5 Jan 2021 14:59:27 -0500 Subject: [PATCH] [SLP] reduce code duplication; NFC --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 8965a44..390b71e 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7137,8 +7137,9 @@ private: 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 @@ private: case RecurKind::UMax: case RecurKind::UMin: { auto *VecCondTy = cast(CmpInst::makeCmpResultType(VecTy)); - RecurKind Kind = RdxTreeInst.getKind(); bool IsUnsigned = Kind == RecurKind::UMax || Kind == RecurKind::UMin; SplittingRdxCost = TTI->getMinMaxReductionCost(VecTy, VecCondTy, @@ -7167,7 +7167,7 @@ private: } int ScalarReduxCost = 0; - switch (RdxTreeInst.getKind()) { + switch (Kind) { case RecurKind::Add: case RecurKind::Mul: case RecurKind::Or: -- 2.7.4