summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-06-16 21:55:10 +0000
committerAdam Nemet <anemet@apple.com>2016-06-16 21:55:10 +0000
commit886e0617a2e90b6a3905fd819280a8eeae75f945 (patch)
treeef4c530c9d2575775ae0ac5bca8e5a901377abc2
parent660b1a49dc4f387f9fc42631ed832f53d00ff44f (diff)
downloadbcm5719-llvm-886e0617a2e90b6a3905fd819280a8eeae75f945.tar.gz
bcm5719-llvm-886e0617a2e90b6a3905fd819280a8eeae75f945.zip
[LV] Make getSymbolicStrides return a pointer rather than a reference. NFC
Turns out SymbolicStrides is actually used in canVectorizeWithIfConvert before it gets set up in canVectorizeMemory. This works fine as long as SymbolicStrides resides in LV since we just have an empty map. Based on this the conclusion is made that there are no symbolic strides which is conservatively correct. However once SymbolicStrides becomes part of LAI, LAI is nullptr at this point so we need to differentiate the uninitialized state by returning a nullptr for SymbolicStrides. llvm-svn: 272966
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 2fbd9725dbd..07034249f51 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1450,7 +1450,7 @@ private:
/// \brief If an access has a symbolic strides, this maps the pointer value to
/// the stride symbol.
- const ValueToValueMap &getSymbolicStrides() { return SymbolicStrides; }
+ const ValueToValueMap *getSymbolicStrides() { return &SymbolicStrides; }
unsigned NumPredStores;
@@ -2224,7 +2224,7 @@ int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
// We can emit wide load/stores only if the last non-zero index is the
// induction variable.
const SCEV *Last = nullptr;
- if (!getSymbolicStrides().count(Gep))
+ if (!getSymbolicStrides() || !getSymbolicStrides()->count(Gep))
Last = PSE.getSCEV(Gep->getOperand(InductionOperand));
else {
// Because of the multiplication by a stride we can have a s/zext cast.
@@ -2236,7 +2236,7 @@ int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
// %idxprom = zext i32 %mul to i64 << Safe cast.
// %arrayidx = getelementptr inbounds i32* %B, i64 %idxprom
//
- Last = replaceSymbolicStrideSCEV(PSE, getSymbolicStrides(),
+ Last = replaceSymbolicStrideSCEV(PSE, *getSymbolicStrides(),
Gep->getOperand(InductionOperand), Gep);
if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(Last))
Last =
@@ -4667,7 +4667,7 @@ bool LoopVectorizationLegality::canVectorize() {
// Analyze interleaved memory accesses.
if (UseInterleaved)
- InterleaveInfo.analyzeInterleaving(getSymbolicStrides());
+ InterleaveInfo.analyzeInterleaving(*getSymbolicStrides());
unsigned SCEVThreshold = VectorizeSCEVCheckThreshold;
if (Hints->getForce() == LoopVectorizeHints::FK_Enabled)
@@ -4998,7 +4998,7 @@ void LoopVectorizationLegality::collectLoopUniforms() {
}
bool LoopVectorizationLegality::canVectorizeMemory() {
- LAI = &LAA->getInfo(TheLoop, getSymbolicStrides());
+ LAI = &LAA->getInfo(TheLoop, *getSymbolicStrides());
auto &OptionalReport = LAI->getReport();
if (OptionalReport)
emitAnalysis(VectorizationReport(*OptionalReport));
OpenPOWER on IntegriCloud