[PATCH] D22532: [LSV] Nix two global (ish) variables in the LoadStoreVectorizer. NFC
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 14:17:13 PDT 2016
jlebar created this revision.
jlebar added a reviewer: asbirlea.
jlebar added subscribers: arsenm, llvm-commits.
Herald added a subscriber: mzolotukhin.
https://reviews.llvm.org/D22532
Files:
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Index: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -43,19 +43,17 @@
// 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;
ScalarEvolution &SE;
TargetTransformInfo &TTI;
const DataLayout &DL;
IRBuilder<> Builder;
- ValueListMap StoreRefs;
- ValueListMap LoadRefs;
public:
Vectorizer(Function &F, AliasAnalysis &AA, DominatorTree &DT,
@@ -115,7 +113,7 @@
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 @@
// 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 @@
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 @@
StoreRefs[ObjPtr].push_back(SI);
}
}
+
+ return {LoadRefs, StoreRefs};
}
bool Vectorizer::vectorizeChains(ValueListMap &Map) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22532.64561.patch
Type: text/x-patch
Size: 2112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/9f7e8c27/attachment.bin>
More information about the llvm-commits
mailing list