llvm.org GIT mirror llvm / eb2d425
[PM] Fix a think-o. mv {Scalar,Vectorize}/SLPVectorize.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274960 91177308-0d34-0410-b5e6-96231b3b80d8 Sean Silva 4 years ago
4 changed file(s) with 115 addition(s) and 115 deletion(s). Raw diff Collapse all Expand all
+0
-113
include/llvm/Transforms/Scalar/SLPVectorizer.h less more
None //===---- SLPVectorizer.h ---------------------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 // This pass implements the Bottom Up SLP vectorizer. It detects consecutive
9 // stores that can be put together into vector-stores. Next, it attempts to
10 // construct vectorizable tree using the use-def chains. If a profitable tree
11 // was found, the SLP vectorizer performs vectorization on the tree.
12 //
13 // The pass is inspired by the work described in the paper:
14 // "Loop-Aware SLP in GCC" by Ira Rosen, Dorit Nuzman, Ayal Zaks.
15 //
16 //===----------------------------------------------------------------------===//
17
18 #ifndef LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
19 #define LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
20
21 #include "llvm/ADT/MapVector.h"
22 #include "llvm/Analysis/AliasAnalysis.h"
23 #include "llvm/Analysis/AssumptionCache.h"
24 #include "llvm/Analysis/DemandedBits.h"
25 #include "llvm/Analysis/LoopInfo.h"
26 #include "llvm/Analysis/ScalarEvolution.h"
27 #include "llvm/Analysis/TargetTransformInfo.h"
28 #include "llvm/IR/Function.h"
29 #include "llvm/IR/PassManager.h"
30
31 namespace llvm {
32
33 /// A private "module" namespace for types and utilities used by this pass.
34 /// These are implementation details and should not be used by clients.
35 namespace slpvectorizer {
36 class BoUpSLP;
37 }
38
39 struct SLPVectorizerPass : public PassInfoMixin {
40 typedef SmallVector StoreList;
41 typedef MapVector StoreListMap;
42 typedef SmallVector WeakVHList;
43 typedef MapVector WeakVHListMap;
44
45 ScalarEvolution *SE = nullptr;
46 TargetTransformInfo *TTI = nullptr;
47 TargetLibraryInfo *TLI = nullptr;
48 AliasAnalysis *AA = nullptr;
49 LoopInfo *LI = nullptr;
50 DominatorTree *DT = nullptr;
51 AssumptionCache *AC = nullptr;
52 DemandedBits *DB = nullptr;
53 const DataLayout *DL = nullptr;
54
55 public:
56 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
57
58 // Glue for old PM.
59 bool runImpl(Function &F, ScalarEvolution *SE_, TargetTransformInfo *TTI_,
60 TargetLibraryInfo *TLI_, AliasAnalysis *AA_, LoopInfo *LI_,
61 DominatorTree *DT_, AssumptionCache *AC_, DemandedBits *DB_);
62
63 private:
64 /// \brief Collect store and getelementptr instructions and organize them
65 /// according to the underlying object of their pointer operands. We sort the
66 /// instructions by their underlying objects to reduce the cost of
67 /// consecutive access queries.
68 ///
69 /// TODO: We can further reduce this cost if we flush the chain creation
70 /// every time we run into a memory barrier.
71 void collectSeedInstructions(BasicBlock *BB);
72
73 /// \brief Try to vectorize a chain that starts at two arithmetic instrs.
74 bool tryToVectorizePair(Value *A, Value *B, slpvectorizer::BoUpSLP &R);
75
76 /// \brief Try to vectorize a list of operands.
77 /// \@param BuildVector A list of users to ignore for the purpose of
78 /// scheduling and that don't need extracting.
79 /// \returns true if a value was vectorized.
80 bool tryToVectorizeList(ArrayRef VL, slpvectorizer::BoUpSLP &R,
81 ArrayRef BuildVector = None,
82 bool allowReorder = false);
83
84 /// \brief Try to vectorize a chain that may start at the operands of \V;
85 bool tryToVectorize(BinaryOperator *V, slpvectorizer::BoUpSLP &R);
86
87 /// \brief Vectorize the store instructions collected in Stores.
88 bool vectorizeStoreChains(slpvectorizer::BoUpSLP &R);
89
90 /// \brief Vectorize the index computations of the getelementptr instructions
91 /// collected in GEPs.
92 bool vectorizeGEPIndices(BasicBlock *BB, slpvectorizer::BoUpSLP &R);
93
94 /// \brief Scan the basic block and look for patterns that are likely to start
95 /// a vectorization chain.
96 bool vectorizeChainsInBlock(BasicBlock *BB, slpvectorizer::BoUpSLP &R);
97
98 bool vectorizeStoreChain(ArrayRef Chain, int CostThreshold,
99 slpvectorizer::BoUpSLP &R, unsigned VecRegSize);
100
101 bool vectorizeStores(ArrayRef Stores, int costThreshold,
102 slpvectorizer::BoUpSLP &R);
103
104 /// The store instructions in a basic block organized by base pointer.
105 StoreListMap Stores;
106
107 /// The getelementptr instructions in a basic block organized by base pointer.
108 WeakVHListMap GEPs;
109 };
110 }
111
112 #endif // LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
0 //===---- SLPVectorizer.h ---------------------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 // This pass implements the Bottom Up SLP vectorizer. It detects consecutive
9 // stores that can be put together into vector-stores. Next, it attempts to
10 // construct vectorizable tree using the use-def chains. If a profitable tree
11 // was found, the SLP vectorizer performs vectorization on the tree.
12 //
13 // The pass is inspired by the work described in the paper:
14 // "Loop-Aware SLP in GCC" by Ira Rosen, Dorit Nuzman, Ayal Zaks.
15 //
16 //===----------------------------------------------------------------------===//
17
18 #ifndef LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
19 #define LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
20
21 #include "llvm/ADT/MapVector.h"
22 #include "llvm/Analysis/AliasAnalysis.h"
23 #include "llvm/Analysis/AssumptionCache.h"
24 #include "llvm/Analysis/DemandedBits.h"
25 #include "llvm/Analysis/LoopInfo.h"
26 #include "llvm/Analysis/ScalarEvolution.h"
27 #include "llvm/Analysis/TargetTransformInfo.h"
28 #include "llvm/IR/Function.h"
29 #include "llvm/IR/PassManager.h"
30
31 namespace llvm {
32
33 /// A private "module" namespace for types and utilities used by this pass.
34 /// These are implementation details and should not be used by clients.
35 namespace slpvectorizer {
36 class BoUpSLP;
37 }
38
39 struct SLPVectorizerPass : public PassInfoMixin {
40 typedef SmallVector StoreList;
41 typedef MapVector StoreListMap;
42 typedef SmallVector WeakVHList;
43 typedef MapVector WeakVHListMap;
44
45 ScalarEvolution *SE = nullptr;
46 TargetTransformInfo *TTI = nullptr;
47 TargetLibraryInfo *TLI = nullptr;
48 AliasAnalysis *AA = nullptr;
49 LoopInfo *LI = nullptr;
50 DominatorTree *DT = nullptr;
51 AssumptionCache *AC = nullptr;
52 DemandedBits *DB = nullptr;
53 const DataLayout *DL = nullptr;
54
55 public:
56 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
57
58 // Glue for old PM.
59 bool runImpl(Function &F, ScalarEvolution *SE_, TargetTransformInfo *TTI_,
60 TargetLibraryInfo *TLI_, AliasAnalysis *AA_, LoopInfo *LI_,
61 DominatorTree *DT_, AssumptionCache *AC_, DemandedBits *DB_);
62
63 private:
64 /// \brief Collect store and getelementptr instructions and organize them
65 /// according to the underlying object of their pointer operands. We sort the
66 /// instructions by their underlying objects to reduce the cost of
67 /// consecutive access queries.
68 ///
69 /// TODO: We can further reduce this cost if we flush the chain creation
70 /// every time we run into a memory barrier.
71 void collectSeedInstructions(BasicBlock *BB);
72
73 /// \brief Try to vectorize a chain that starts at two arithmetic instrs.
74 bool tryToVectorizePair(Value *A, Value *B, slpvectorizer::BoUpSLP &R);
75
76 /// \brief Try to vectorize a list of operands.
77 /// \@param BuildVector A list of users to ignore for the purpose of
78 /// scheduling and that don't need extracting.
79 /// \returns true if a value was vectorized.
80 bool tryToVectorizeList(ArrayRef VL, slpvectorizer::BoUpSLP &R,
81 ArrayRef BuildVector = None,
82 bool allowReorder = false);
83
84 /// \brief Try to vectorize a chain that may start at the operands of \V;
85 bool tryToVectorize(BinaryOperator *V, slpvectorizer::BoUpSLP &R);
86
87 /// \brief Vectorize the store instructions collected in Stores.
88 bool vectorizeStoreChains(slpvectorizer::BoUpSLP &R);
89
90 /// \brief Vectorize the index computations of the getelementptr instructions
91 /// collected in GEPs.
92 bool vectorizeGEPIndices(BasicBlock *BB, slpvectorizer::BoUpSLP &R);
93
94 /// \brief Scan the basic block and look for patterns that are likely to start
95 /// a vectorization chain.
96 bool vectorizeChainsInBlock(BasicBlock *BB, slpvectorizer::BoUpSLP &R);
97
98 bool vectorizeStoreChain(ArrayRef Chain, int CostThreshold,
99 slpvectorizer::BoUpSLP &R, unsigned VecRegSize);
100
101 bool vectorizeStores(ArrayRef Stores, int costThreshold,
102 slpvectorizer::BoUpSLP &R);
103
104 /// The store instructions in a basic block organized by base pointer.
105 StoreListMap Stores;
106
107 /// The getelementptr instructions in a basic block organized by base pointer.
108 WeakVHListMap GEPs;
109 };
110 }
111
112 #endif // LLVM_TRANSFORMS_SCALAR_SLPVECTORIZER_H
9494 #include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h"
9595 #include "llvm/Transforms/Scalar/Reassociate.h"
9696 #include "llvm/Transforms/Scalar/SCCP.h"
97 #include "llvm/Transforms/Scalar/SLPVectorizer.h"
9897 #include "llvm/Transforms/Scalar/SROA.h"
9998 #include "llvm/Transforms/Scalar/SimplifyCFG.h"
10099 #include "llvm/Transforms/Scalar/Sink.h"
105104 #include "llvm/Transforms/Utils/Mem2Reg.h"
106105 #include "llvm/Transforms/Utils/MemorySSA.h"
107106 #include "llvm/Transforms/Utils/SimplifyInstructions.h"
107 #include "llvm/Transforms/Vectorize/SLPVectorizer.h"
108108
109109 #include
110110
1414 // "Loop-Aware SLP in GCC" by Ira Rosen, Dorit Nuzman, Ayal Zaks.
1515 //
1616 //===----------------------------------------------------------------------===//
17 #include "llvm/Transforms/Scalar/SLPVectorizer.h"
17 #include "llvm/Transforms/Vectorize/SLPVectorizer.h"
1818 #include "llvm/ADT/Optional.h"
1919 #include "llvm/ADT/PostOrderIterator.h"
2020 #include "llvm/ADT/SetVector.h"