diff options
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 3945807fee7..1ddb45e5df6 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -107,13 +107,13 @@ STATISTIC(LoopsVectorized, "Number of loops vectorized"); STATISTIC(LoopsAnalyzed, "Number of loops analyzed for vectorization"); static cl::opt<unsigned> - VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden, - cl::desc("Sets the SIMD width. Zero is autoselect.")); +VectorizationFactor("force-vector-width", cl::init(0), cl::Hidden, + cl::desc("Sets the SIMD width. Zero is autoselect.")); static cl::opt<unsigned> - VectorizationInterleave("force-vector-interleave", cl::init(0), cl::Hidden, - cl::desc("Sets the vectorization interleave count. " - "Zero is autoselect.")); +VectorizationInterleave("force-vector-interleave", cl::init(0), cl::Hidden, + cl::desc("Sets the vectorization interleave count. " + "Zero is autoselect.")); static cl::opt<bool> EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden, @@ -548,8 +548,9 @@ public: DominatorTree *DT, TargetLibraryInfo *TLI, AliasAnalysis *AA, Function *F, const TargetTransformInfo *TTI) - : NumPredStores(0), TheLoop(L), SE(SE), DL(DL), TLI(TLI), TheFunction(F), - TTI(TTI), DT(DT), Induction(nullptr), WidestIndTy(nullptr), + : NumPredStores(0), TheLoop(L), SE(SE), DL(DL), + TLI(TLI), TheFunction(F), TTI(TTI), DT(DT), Induction(nullptr), + WidestIndTy(nullptr), LAI(F, L, SE, DL, TLI, AA, DT, LoopAccessInfo::VectorizerParams( MaxVectorWidth, VectorizationFactor, VectorizationInterleave, @@ -743,7 +744,9 @@ public: return LAI.getRuntimePointerCheck(); } - LoopAccessInfo *getLAI() { return &LAI; } + LoopAccessInfo *getLAI() { + return &LAI; + } /// This function returns the identity element (or neutral element) for /// the operation K. @@ -770,11 +773,18 @@ public: } /// Returns true if vector representation of the instruction \p I /// requires mask. - bool isMaskRequired(const Instruction *I) { return (MaskedOp.count(I) != 0); } - unsigned getNumStores() const { return LAI.getNumStores(); } - unsigned getNumLoads() const { return LAI.getNumLoads(); } - unsigned getNumPredStores() const { return NumPredStores; } - + bool isMaskRequired(const Instruction* I) { + return (MaskedOp.count(I) != 0); + } + unsigned getNumStores() const { + return LAI.getNumStores(); + } + unsigned getNumLoads() const { + return LAI.getNumLoads(); + } + unsigned getNumPredStores() const { + return NumPredStores; + } private: /// Check if a single basic block loop is vectorizable. /// At this point we know that this is a loop with a constant trip count @@ -865,7 +875,7 @@ private: SmallPtrSet<Value*, 4> AllowedExit; /// This set holds the variables which are known to be uniform after /// vectorization. - SmallPtrSet<Instruction *, 4> Uniforms; + SmallPtrSet<Instruction*, 4> Uniforms; LoopAccessInfo LAI; /// Can we assume the absence of NaNs. bool HasFunNoNaNAttr; @@ -1649,7 +1659,9 @@ int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) { return 0; } -bool LoopVectorizationLegality::isUniform(Value *V) { return LAI.isUniform(V); } +bool LoopVectorizationLegality::isUniform(Value *V) { + return LAI.isUniform(V); +} InnerLoopVectorizer::VectorParts& InnerLoopVectorizer::getVectorValue(Value *V) { @@ -3387,10 +3399,10 @@ bool LoopVectorizationLegality::canVectorize() { // Collect all of the variables that remain uniform after vectorization. collectLoopUniforms(); - DEBUG(dbgs() << "LV: We can vectorize this loop" - << (LAI.getRuntimePointerCheck()->Need - ? " (with a runtime bound check)" - : "") << "!\n"); + DEBUG(dbgs() << "LV: We can vectorize this loop" << + (LAI.getRuntimePointerCheck()->Need ? " (with a runtime bound check)" : + "") + <<"!\n"); // Okay! We can vectorize. At this point we don't have any other mem analysis // which may limit our maximum vectorization factor, so just return true with |

