summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/VecUtils.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-04-15 22:00:26 +0000
committerNadav Rotem <nrotem@apple.com>2013-04-15 22:00:26 +0000
commitb9116e69666de1d6da41af6554beb9ceb2835db8 (patch)
tree0e77720614741204f8c380b58172026257180ec9 /llvm/lib/Transforms/Vectorize/VecUtils.cpp
parentc8c5b8dcd79c5ca14a21fcc2476e52862dd0bf18 (diff)
downloadbcm5719-llvm-b9116e69666de1d6da41af6554beb9ceb2835db8.tar.gz
bcm5719-llvm-b9116e69666de1d6da41af6554beb9ceb2835db8.zip
SLPVectorizer: Make it a function pass and add code for hoisting the vector-gather sequence out of loops.
llvm-svn: 179562
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/VecUtils.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VecUtils.cpp b/llvm/lib/Transforms/Vectorize/VecUtils.cpp
index c85711532dd..a69646336c8 100644
--- a/llvm/lib/Transforms/Vectorize/VecUtils.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud