[llvm] r276054 - [LSV] Nix two global (ish) variables in the LoadStoreVectorizer. NFC
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 16:19:16 PDT 2016
Author: jlebar
Date: Tue Jul 19 18:19:16 2016
New Revision: 276054
URL: http://llvm.org/viewvc/llvm-project?rev=276054&view=rev
Log:
[LSV] Nix two global (ish) variables in the LoadStoreVectorizer. NFC
Reviewers: asbirlea
Subscribers: mzolotukhin, llvm-commits, arsenm
Differential Revision: https://reviews.llvm.org/D22532
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp?rev=276054&r1=276053&r2=276054&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp Tue Jul 19 18:19:16 2016
@@ -43,10 +43,10 @@ namespace {
// TODO: Remove this
static const unsigned TargetBaseAlign = 4;
-class Vectorizer {
- typedef SmallVector<Value *, 8> ValueList;
- typedef MapVector<Value *, ValueList> ValueListMap;
+typedef SmallVector<Value *, 8> ValueList;
+typedef MapVector<Value *, ValueList> ValueListMap;
+class Vectorizer {
Function &F;
AliasAnalysis &AA;
DominatorTree &DT;
@@ -54,8 +54,6 @@ class Vectorizer {
TargetTransformInfo &TTI;
const DataLayout &DL;
IRBuilder<> Builder;
- ValueListMap StoreRefs;
- ValueListMap LoadRefs;
public:
Vectorizer(Function &F, AliasAnalysis &AA, DominatorTree &DT,
@@ -115,7 +113,7 @@ private:
BasicBlock::iterator To);
/// Collects load and store instructions to vectorize.
- void collectInstructions(BasicBlock *BB);
+ std::pair<ValueListMap, ValueListMap> collectInstructions(BasicBlock *BB);
/// Processes the collected instructions, the \p Map. The elements of \p Map
/// should be all loads or all stores.
@@ -198,7 +196,8 @@ bool Vectorizer::run() {
// Scan the blocks in the function in post order.
for (BasicBlock *BB : post_order(&F)) {
- collectInstructions(BB);
+ ValueListMap LoadRefs, StoreRefs;
+ std::tie(LoadRefs, StoreRefs) = collectInstructions(BB);
Changed |= vectorizeChains(LoadRefs);
Changed |= vectorizeChains(StoreRefs);
}
@@ -493,9 +492,10 @@ unsigned Vectorizer::getVectorizablePref
return Chain.size();
}
-void Vectorizer::collectInstructions(BasicBlock *BB) {
- LoadRefs.clear();
- StoreRefs.clear();
+std::pair<ValueListMap, ValueListMap>
+Vectorizer::collectInstructions(BasicBlock *BB) {
+ ValueListMap LoadRefs;
+ ValueListMap StoreRefs;
for (Instruction &I : *BB) {
if (!I.mayReadOrWriteMemory())
@@ -569,6 +569,8 @@ void Vectorizer::collectInstructions(Bas
StoreRefs[ObjPtr].push_back(SI);
}
}
+
+ return {LoadRefs, StoreRefs};
}
bool Vectorizer::vectorizeChains(ValueListMap &Map) {
More information about the llvm-commits
mailing list