aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h')
-rw-r--r--include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h60
1 files changed, 23 insertions, 37 deletions
diff --git a/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index 5c7bba048607..b144006e2628 100644
--- a/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Vectorize/LoopVectorizationLegality.h ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -99,11 +98,7 @@ public:
OptimizationRemarkEmitter &ORE);
/// Mark the loop L as already vectorized by setting the width to 1.
- void setAlreadyVectorized() {
- IsVectorized.Value = 1;
- Hint Hints[] = {IsVectorized};
- writeHintsToMetadata(Hints);
- }
+ void setAlreadyVectorized();
bool allowVectorization(Function *F, Loop *L,
bool VectorizeOnlyWhenForced) const;
@@ -152,15 +147,6 @@ private:
/// Checks string hint with one operand and set value if valid.
void setHint(StringRef Name, Metadata *Arg);
- /// Create a new hint from name / value pair.
- MDNode *createHintMetadata(StringRef Name, unsigned V) const;
-
- /// Matches metadata with hint name.
- bool matchesHintMetadataName(MDNode *Node, ArrayRef<Hint> HintTypes);
-
- /// Sets current hints into loop metadata, keeping other values intact.
- void writeHintsToMetadata(ArrayRef<Hint> HintTypes);
-
/// The loop these hints belong to.
const Loop *TheLoop;
@@ -219,12 +205,13 @@ class LoopVectorizationLegality {
public:
LoopVectorizationLegality(
Loop *L, PredicatedScalarEvolution &PSE, DominatorTree *DT,
- TargetLibraryInfo *TLI, AliasAnalysis *AA, Function *F,
- std::function<const LoopAccessInfo &(Loop &)> *GetLAA, LoopInfo *LI,
- OptimizationRemarkEmitter *ORE, LoopVectorizationRequirements *R,
- LoopVectorizeHints *H, DemandedBits *DB, AssumptionCache *AC)
- : TheLoop(L), LI(LI), PSE(PSE), TLI(TLI), DT(DT), GetLAA(GetLAA),
- ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC) {}
+ TargetTransformInfo *TTI, TargetLibraryInfo *TLI, AliasAnalysis *AA,
+ Function *F, std::function<const LoopAccessInfo &(Loop &)> *GetLAA,
+ LoopInfo *LI, OptimizationRemarkEmitter *ORE,
+ LoopVectorizationRequirements *R, LoopVectorizeHints *H, DemandedBits *DB,
+ AssumptionCache *AC)
+ : TheLoop(L), LI(LI), PSE(PSE), TTI(TTI), TLI(TLI), DT(DT),
+ GetLAA(GetLAA), ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC) {}
/// ReductionList contains the reduction descriptors for all
/// of the reductions that were found in the loop.
@@ -385,18 +372,6 @@ private:
void addInductionPhi(PHINode *Phi, const InductionDescriptor &ID,
SmallPtrSetImpl<Value *> &AllowedExit);
- /// Create an analysis remark that explains why vectorization failed
- ///
- /// \p RemarkName is the identifier for the remark. If \p I is passed it is
- /// an instruction that prevents vectorization. Otherwise the loop is used
- /// for the location of the remark. \return the remark object that can be
- /// streamed to.
- OptimizationRemarkAnalysis
- createMissedAnalysis(StringRef RemarkName, Instruction *I = nullptr) const {
- return createLVMissedAnalysis(Hints->vectorizeAnalysisPassName(),
- RemarkName, TheLoop, I);
- }
-
/// If an access has a symbolic strides, this maps the pointer value to
/// the stride symbol.
const ValueToValueMap *getSymbolicStrides() {
@@ -407,6 +382,14 @@ private:
return LAI ? &LAI->getSymbolicStrides() : nullptr;
}
+ /// Reports a vectorization illegality: print \p DebugMsg for debugging
+ /// purposes along with the corresponding optimization remark \p RemarkName.
+ /// If \p I is passed it is an instruction that prevents vectorization.
+ /// Otherwise the loop is used for the location of the remark.
+ void reportVectorizationFailure(const StringRef DebugMsg,
+ const StringRef OREMsg, const StringRef ORETag,
+ Instruction *I = nullptr) const;
+
/// The loop that we evaluate.
Loop *TheLoop;
@@ -420,6 +403,9 @@ private:
/// unrolling.
PredicatedScalarEvolution &PSE;
+ /// Target Transform Info.
+ TargetTransformInfo *TTI;
+
/// Target Library Info.
TargetLibraryInfo *TLI;
@@ -479,7 +465,7 @@ private:
/// Used to emit an analysis of any legality issues.
LoopVectorizeHints *Hints;
- /// The demanded bits analsyis is used to compute the minimum type size in
+ /// The demanded bits analysis is used to compute the minimum type size in
/// which a reduction can be computed.
DemandedBits *DB;