Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | static Optional<unsigned> getSmallBestKnownTC(ScalarEvolution &SE, Loop *L) { | ||||
return None; | return None; | ||||
} | } | ||||
// Forward declare GeneratedRTChecks. | // Forward declare GeneratedRTChecks. | ||||
class GeneratedRTChecks; | class GeneratedRTChecks; | ||||
namespace llvm { | namespace llvm { | ||||
AnalysisKey ShouldRunExtraVectorPasses::Key; | |||||
/// InnerLoopVectorizer vectorizes loops which contain only one basic | /// InnerLoopVectorizer vectorizes loops which contain only one basic | ||||
/// block to a specified vectorization factor (VF). | /// block to a specified vectorization factor (VF). | ||||
/// This class performs the widening of scalars into vectors, or multiple | /// This class performs the widening of scalars into vectors, or multiple | ||||
/// scalars. This class also implements the following features: | /// scalars. This class also implements the following features: | ||||
/// * It inserts an epilogue loop for handling loops that don't have iteration | /// * It inserts an epilogue loop for handling loops that don't have iteration | ||||
/// counts that are known to be a multiple of the vectorization factor. | /// counts that are known to be a multiple of the vectorization factor. | ||||
/// * It handles the code generation for reduction variables. | /// * It handles the code generation for reduction variables. | ||||
/// * Scalarization (implementation using scalars) of un-vectorizable | /// * Scalarization (implementation using scalars) of un-vectorizable | ||||
▲ Show 20 Lines • Show All 10,308 Lines • ▼ Show 20 Lines | PreservedAnalyses LoopVectorizePass::run(Function &F, | ||||
// We currently do not preserve loopinfo/dominator analyses with outer loop | // We currently do not preserve loopinfo/dominator analyses with outer loop | ||||
// vectorization. Until this is addressed, mark these analyses as preserved | // vectorization. Until this is addressed, mark these analyses as preserved | ||||
// only for non-VPlan-native path. | // only for non-VPlan-native path. | ||||
// TODO: Preserve Loop and Dominator analyses for VPlan-native path. | // TODO: Preserve Loop and Dominator analyses for VPlan-native path. | ||||
if (!EnableVPlanNativePath) { | if (!EnableVPlanNativePath) { | ||||
PA.preserve<LoopAnalysis>(); | PA.preserve<LoopAnalysis>(); | ||||
PA.preserve<DominatorTreeAnalysis>(); | PA.preserve<DominatorTreeAnalysis>(); | ||||
} | } | ||||
if (!Result.MadeCFGChange) | |||||
if (Result.MadeCFGChange) { | |||||
// Making CFG changes likely means a loop got vectorized. Indicate that | |||||
aeubanks: add a TODO for more precise vectorization tracking? | |||||
// extra simplification passes should be run. | |||||
// TODO: MadeCFGChanges is not a prefect proxy. Extra passes should only | |||||
// be run if runtime checks have been added. | |||||
AM.getResult<ShouldRunExtraVectorPasses>(F); | |||||
PA.preserve<ShouldRunExtraVectorPasses>(); | |||||
} else { | |||||
PA.preserveSet<CFGAnalyses>(); | PA.preserveSet<CFGAnalyses>(); | ||||
} | |||||
return PA; | return PA; | ||||
} | } | ||||
void LoopVectorizePass::printPipeline( | void LoopVectorizePass::printPipeline( | ||||
raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) { | raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) { | ||||
static_cast<PassInfoMixin<LoopVectorizePass> *>(this)->printPipeline( | static_cast<PassInfoMixin<LoopVectorizePass> *>(this)->printPipeline( | ||||
OS, MapClassName2PassName); | OS, MapClassName2PassName); | ||||
OS << "<"; | OS << "<"; | ||||
OS << (InterleaveOnlyWhenForced ? "" : "no-") << "interleave-forced-only;"; | OS << (InterleaveOnlyWhenForced ? "" : "no-") << "interleave-forced-only;"; | ||||
OS << (VectorizeOnlyWhenForced ? "" : "no-") << "vectorize-forced-only;"; | OS << (VectorizeOnlyWhenForced ? "" : "no-") << "vectorize-forced-only;"; | ||||
OS << ">"; | OS << ">"; | ||||
} | } |
add a TODO for more precise vectorization tracking?