[SLP] Remove unnecessary member variables by using container APIs.

This changes the debug output, but still retains its usefulness.
Differential Revision: http://reviews.llvm.org/D18324

llvm-svn: 263975
This commit is contained in:
Chad Rosier 2016-03-21 19:47:44 +00:00
parent 920341c7a9
commit 2e5c526bb1
1 changed files with 6 additions and 13 deletions

View File

@ -3439,8 +3439,9 @@ struct SLPVectorizer : public FunctionPass {
collectSeedInstructions(BB); collectSeedInstructions(BB);
// Vectorize trees that end at stores. // Vectorize trees that end at stores.
if (NumStores > 0) { if (!Stores.empty()) {
DEBUG(dbgs() << "SLP: Found " << NumStores << " stores.\n"); DEBUG(dbgs() << "SLP: Found stores for " << Stores.size()
<< " underlying objects.\n");
Changed |= vectorizeStoreChains(R); Changed |= vectorizeStoreChains(R);
} }
@ -3450,8 +3451,9 @@ struct SLPVectorizer : public FunctionPass {
// Vectorize the index computations of getelementptr instructions. This // Vectorize the index computations of getelementptr instructions. This
// is primarily intended to catch gather-like idioms ending at // is primarily intended to catch gather-like idioms ending at
// non-consecutive loads. // non-consecutive loads.
if (NumGEPs > 0) { if (!GEPs.empty()) {
DEBUG(dbgs() << "SLP: Found " << NumGEPs << " GEPs.\n"); DEBUG(dbgs() << "SLP: Found GEPs for " << GEPs.size()
<< " underlying objects.\n");
Changed |= vectorizeGEPIndices(BB, R); Changed |= vectorizeGEPIndices(BB, R);
} }
} }
@ -3527,12 +3529,6 @@ private:
/// The getelementptr instructions in a basic block organized by base pointer. /// The getelementptr instructions in a basic block organized by base pointer.
WeakVHListMap GEPs; WeakVHListMap GEPs;
/// The number of store instructions in a basic block.
unsigned NumStores;
/// The number of getelementptr instructions in a basic block.
unsigned NumGEPs;
unsigned MaxVecRegSize; // This is set by TTI or overridden by cl::opt. unsigned MaxVecRegSize; // This is set by TTI or overridden by cl::opt.
unsigned MinVecRegSize; // Set by cl::opt (default: 128). unsigned MinVecRegSize; // Set by cl::opt (default: 128).
}; };
@ -3670,7 +3666,6 @@ void SLPVectorizer::collectSeedInstructions(BasicBlock *BB) {
// Initialize the collections. We will make a single pass over the block. // Initialize the collections. We will make a single pass over the block.
Stores.clear(); Stores.clear();
GEPs.clear(); GEPs.clear();
NumStores = NumGEPs = 0;
// Visit the store and getelementptr instructions in BB and organize them in // Visit the store and getelementptr instructions in BB and organize them in
// Stores and GEPs according to the underlying objects of their pointer // Stores and GEPs according to the underlying objects of their pointer
@ -3685,7 +3680,6 @@ void SLPVectorizer::collectSeedInstructions(BasicBlock *BB) {
if (!isValidElementType(SI->getValueOperand()->getType())) if (!isValidElementType(SI->getValueOperand()->getType()))
continue; continue;
Stores[GetUnderlyingObject(SI->getPointerOperand(), *DL)].push_back(SI); Stores[GetUnderlyingObject(SI->getPointerOperand(), *DL)].push_back(SI);
++NumStores;
} }
// Ignore getelementptr instructions that have more than one index, a // Ignore getelementptr instructions that have more than one index, a
@ -3698,7 +3692,6 @@ void SLPVectorizer::collectSeedInstructions(BasicBlock *BB) {
if (!isValidElementType(Idx->getType())) if (!isValidElementType(Idx->getType()))
continue; continue;
GEPs[GetUnderlyingObject(GEP->getPointerOperand(), *DL)].push_back(GEP); GEPs[GetUnderlyingObject(GEP->getPointerOperand(), *DL)].push_back(GEP);
++NumGEPs;
} }
} }
} }