diff options
author | Michael Kuperstein <mkuper@google.com> | 2017-01-21 02:03:03 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2017-01-21 02:03:03 +0000 |
commit | 807982359d381d4ce017784e0aacc6ffde73a833 (patch) | |
tree | 03e5eac0a30497980f8b6cc5d377d232e3649e8c /llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | |
parent | 910dc8de3f39d2544751f3a433ba81f326d10280 (diff) | |
download | bcm5719-llvm-807982359d381d4ce017784e0aacc6ffde73a833.tar.gz bcm5719-llvm-807982359d381d4ce017784e0aacc6ffde73a833.zip |
[SLP] Make ReductionOpcode have the right (enum) type. NFC.
llvm-svn: 292703
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 717790be13c..932c8413dc9 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -4135,7 +4135,7 @@ class HorizontalReduction { WeakVH ReductionPHI; /// The opcode of the reduction. - unsigned ReductionOpcode; + Instruction::BinaryOps ReductionOpcode; /// The opcode of the values we perform a reduction on. unsigned ReducedValueOpcode; /// Should we model this reduction as a pairwise reduction tree or a tree that @@ -4151,8 +4151,8 @@ public: unsigned MinVecRegSize; HorizontalReduction(unsigned MinVecRegSize) - : ReductionRoot(nullptr), ReductionOpcode(0), ReducedValueOpcode(0), - IsPairwiseReduction(false), ReduxWidth(0), + : ReductionRoot(nullptr), ReductionOpcode(Instruction::BinaryOpsEnd), + ReducedValueOpcode(0), IsPairwiseReduction(false), ReduxWidth(0), MinVecRegSize(MinVecRegSize) {} /// \brief Try to find a reduction tree. @@ -4302,9 +4302,8 @@ public: Value *ReducedSubTree = emitReduction(VectorizedRoot, Builder); if (VectorizedTree) { Builder.SetCurrentDebugLocation(Loc); - VectorizedTree = - Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode, - VectorizedTree, ReducedSubTree, "bin.rdx"); + VectorizedTree = Builder.CreateBinOp(ReductionOpcode, VectorizedTree, + ReducedSubTree, "bin.rdx"); } else VectorizedTree = ReducedSubTree; } @@ -4314,9 +4313,8 @@ public: for (; i < NumReducedVals; ++i) { Builder.SetCurrentDebugLocation( cast<Instruction>(ReducedVals[i])->getDebugLoc()); - VectorizedTree = - Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode, - VectorizedTree, ReducedVals[i]); + VectorizedTree = Builder.CreateBinOp(ReductionOpcode, VectorizedTree, + ReducedVals[i]); } // Update users. if (ReductionPHI && !isa<UndefValue>(ReductionPHI)) { @@ -4377,15 +4375,14 @@ private: Value *RightShuf = Builder.CreateShuffleVector( TmpVec, UndefValue::get(TmpVec->getType()), (RightMask), "rdx.shuf.r"); - TmpVec = Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode, - LeftShuf, RightShuf, "bin.rdx"); + TmpVec = Builder.CreateBinOp(ReductionOpcode, LeftShuf, RightShuf, + "bin.rdx"); } else { Value *UpperHalf = createRdxShuffleMask(ReduxWidth, i, false, false, Builder); Value *Shuf = Builder.CreateShuffleVector( TmpVec, UndefValue::get(TmpVec->getType()), UpperHalf, "rdx.shuf"); - TmpVec = Builder.CreateBinOp((Instruction::BinaryOps)ReductionOpcode, - TmpVec, Shuf, "bin.rdx"); + TmpVec = Builder.CreateBinOp(ReductionOpcode, TmpVec, Shuf, "bin.rdx"); } } |