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 | b9116e69666de1d6da41af6554beb9ceb2835db8 (patch) | |
tree | 0e77720614741204f8c380b58172026257180ec9 /llvm/lib/Transforms/Vectorize/VecUtils.h | |
parent | c8c5b8dcd79c5ca14a21fcc2476e52862dd0bf18 (diff) | |
download | bcm5719-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.h')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VecUtils.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VecUtils.h b/llvm/lib/Transforms/Vectorize/VecUtils.h index 03512bf8c34..fed5178b802 100644 --- a/llvm/lib/Transforms/Vectorize/VecUtils.h +++ b/llvm/lib/Transforms/Vectorize/VecUtils.h @@ -71,6 +71,11 @@ struct BoUpSLP { /// \brief Vectorize a group of scalars into a vector tree. void vectorizeArith(ValueList &Operands); + /// \returns the list of new instructions that were added in order to collect + /// scalars into vectors. This list can be used to further optimize the gather + /// sequences. + ValueList &getGatherSeqInstructions() {return GatherInstructions; } + private: /// \brief This method contains the recursive part of getTreeCost. int getTreeCost_rec(ValueList &VL, unsigned Depth); @@ -107,11 +112,11 @@ private: /// \returns a vector from a collection of scalars in \p VL. Value *Scalarize(ValueList &VL, VectorType *Ty); - + private: - // Maps instructions to numbers and back. + /// Maps instructions to numbers and back. SmallDenseMap<Value*, int> InstrIdx; - // Maps integers to Instructions. + /// Maps integers to Instructions. std::vector<Instruction*> InstrVec; // -- containers that are used during getTreeCost -- // @@ -121,21 +126,29 @@ private: /// NOTICE: The vectorization methods also use this set. ValueSet MustScalarize; - // Contains a list of values that are used outside the current tree. This - // set must be reset between runs. + /// Contains a list of values that are used outside the current tree. This + /// set must be reset between runs. ValueSet MultiUserVals; - // Maps values in the tree to the vector lanes that uses them. This map must - // be reset between runs of getCost. + /// Maps values in the tree to the vector lanes that uses them. This map must + /// be reset between runs of getCost. std::map<Value*, int> LaneMap; - // A list of instructions to ignore while sinking - // memory instructions. This map must be reset between runs of getCost. + /// A list of instructions to ignore while sinking + /// memory instructions. This map must be reset between runs of getCost. SmallPtrSet<Value *, 8> MemBarrierIgnoreList; - // -- containers that are used during vectorizeTree -- // - // Maps between the first scalar to the vector. This map must be reset between - // runs. + // -- Containers that are used during vectorizeTree -- // + + /// Maps between the first scalar to the vector. This map must be reset + ///between runs. DenseMap<Value*, Value*> VectorizedValues; + // -- Containers that are used after vectorization by the caller -- // + + /// A list of instructions that are used when gathering scalars into vectors. + /// In many cases these instructions can be hoisted outside of the BB. + /// Iterating over this list is faster than calling LICM. + ValueList GatherInstructions; + // Analysis and block reference. BasicBlock *BB; ScalarEvolution *SE; |