[LV] Add getter function for LoopVectorizationLegality::Strides. NFC

This should help moving Strides to LAA later.

llvm-svn: 272796
This commit is contained in:
Adam Nemet 2016-06-15 15:49:46 +00:00
parent 51a9cc9ce7
commit 82b9d2a72c
1 changed files with 8 additions and 6 deletions

View File

@ -1448,6 +1448,8 @@ private:
emitAnalysisDiag(TheFunction, TheLoop, *Hints, Message); emitAnalysisDiag(TheFunction, TheLoop, *Hints, Message);
} }
ValueToValueMap &getSymbolicStrides() { return SymbolicStrides; }
unsigned NumPredStores; unsigned NumPredStores;
/// The loop that we evaluate. /// The loop that we evaluate.
@ -1508,7 +1510,7 @@ private:
/// Used to emit an analysis of any legality issues. /// Used to emit an analysis of any legality issues.
LoopVectorizeHints *Hints; LoopVectorizeHints *Hints;
ValueToValueMap Strides; ValueToValueMap SymbolicStrides;
SmallPtrSet<Value *, 8> StrideSet; SmallPtrSet<Value *, 8> StrideSet;
/// While vectorizing these instructions we have to generate a /// While vectorizing these instructions we have to generate a
@ -2220,7 +2222,7 @@ int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
// We can emit wide load/stores only if the last non-zero index is the // We can emit wide load/stores only if the last non-zero index is the
// induction variable. // induction variable.
const SCEV *Last = nullptr; const SCEV *Last = nullptr;
if (!Strides.count(Gep)) if (!getSymbolicStrides().count(Gep))
Last = PSE.getSCEV(Gep->getOperand(InductionOperand)); Last = PSE.getSCEV(Gep->getOperand(InductionOperand));
else { else {
// Because of the multiplication by a stride we can have a s/zext cast. // Because of the multiplication by a stride we can have a s/zext cast.
@ -2232,7 +2234,7 @@ int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
// %idxprom = zext i32 %mul to i64 << Safe cast. // %idxprom = zext i32 %mul to i64 << Safe cast.
// %arrayidx = getelementptr inbounds i32* %B, i64 %idxprom // %arrayidx = getelementptr inbounds i32* %B, i64 %idxprom
// //
Last = replaceSymbolicStrideSCEV(PSE, Strides, Last = replaceSymbolicStrideSCEV(PSE, getSymbolicStrides(),
Gep->getOperand(InductionOperand), Gep); Gep->getOperand(InductionOperand), Gep);
if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(Last)) if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(Last))
Last = Last =
@ -4663,7 +4665,7 @@ bool LoopVectorizationLegality::canVectorize() {
// Analyze interleaved memory accesses. // Analyze interleaved memory accesses.
if (UseInterleaved) if (UseInterleaved)
InterleaveInfo.analyzeInterleaving(Strides); InterleaveInfo.analyzeInterleaving(getSymbolicStrides());
unsigned SCEVThreshold = VectorizeSCEVCheckThreshold; unsigned SCEVThreshold = VectorizeSCEVCheckThreshold;
if (Hints->getForce() == LoopVectorizeHints::FK_Enabled) if (Hints->getForce() == LoopVectorizeHints::FK_Enabled)
@ -4952,7 +4954,7 @@ void LoopVectorizationLegality::collectStridedAccess(Value *MemAccess) {
DEBUG(dbgs() << "LV: Found a strided access that we can version"); DEBUG(dbgs() << "LV: Found a strided access that we can version");
DEBUG(dbgs() << " Ptr: " << *Ptr << " Stride: " << *Stride << "\n"); DEBUG(dbgs() << " Ptr: " << *Ptr << " Stride: " << *Stride << "\n");
Strides[Ptr] = Stride; SymbolicStrides[Ptr] = Stride;
StrideSet.insert(Stride); StrideSet.insert(Stride);
} }
@ -4994,7 +4996,7 @@ void LoopVectorizationLegality::collectLoopUniforms() {
} }
bool LoopVectorizationLegality::canVectorizeMemory() { bool LoopVectorizationLegality::canVectorizeMemory() {
LAI = &LAA->getInfo(TheLoop, Strides); LAI = &LAA->getInfo(TheLoop, getSymbolicStrides());
auto &OptionalReport = LAI->getReport(); auto &OptionalReport = LAI->getReport();
if (OptionalReport) if (OptionalReport)
emitAnalysis(VectorizationReport(*OptionalReport)); emitAnalysis(VectorizationReport(*OptionalReport));