diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-04-15 22:00:26 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-04-15 22:00:26 +0000 |
commit | e9a4411db4d3a05965630f668daf8071bf2d3513 (patch) | |
tree | 910f2e83862c8fe7ce21f401a16d00e9ebaf6ffd /lib/Transforms/Vectorize/VecUtils.cpp | |
parent | c9363ef67a5716a282bd7b4810c61da522bb7fd9 (diff) |
SLPVectorizer: Make it a function pass and add code for hoisting the vector-gather sequence out of loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r-- | lib/Transforms/Vectorize/VecUtils.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Transforms/Vectorize/VecUtils.cpp b/lib/Transforms/Vectorize/VecUtils.cpp index c85711532d..a69646336c 100644 --- a/lib/Transforms/Vectorize/VecUtils.cpp +++ b/lib/Transforms/Vectorize/VecUtils.cpp @@ -511,8 +511,15 @@ Instruction *BoUpSLP::GetLastInstr(ValueList &VL, unsigned VF) { Value *BoUpSLP::Scalarize(ValueList &VL, VectorType *Ty) { IRBuilder<> Builder(GetLastInstr(VL, Ty->getNumElements())); Value *Vec = UndefValue::get(Ty); - for (unsigned i=0; i < Ty->getNumElements(); ++i) + for (unsigned i=0; i < Ty->getNumElements(); ++i) { + // Generate the 'InsertElement' instruction. Vec = Builder.CreateInsertElement(Vec, VL[i], Builder.getInt32(i)); + // Remember that this instruction is used as part of a 'gather' sequence. + // The caller of the bottom-up slp vectorizer can try to hoist the sequence + // if the users are outside of the basic block. + GatherInstructions.push_back(Vec); + } + return Vec; } |