[VectorCombine] generalize pass param name for early combines; NFC
The option was added with https://reviews.llvm.org/D102496, and currently the name is accurate, but I am hoping to add a load transform that is not a scalarization. See issue #17113.
This commit is contained in:
parent
ed7870c2e5
commit
8f337f8ffe
|
@ -21,13 +21,13 @@ namespace llvm {
|
||||||
|
|
||||||
/// Optimize scalar/vector interactions in IR using target cost models.
|
/// Optimize scalar/vector interactions in IR using target cost models.
|
||||||
class VectorCombinePass : public PassInfoMixin<VectorCombinePass> {
|
class VectorCombinePass : public PassInfoMixin<VectorCombinePass> {
|
||||||
/// If true only perform scalarization combines and do not introduce new
|
/// If true, only perform beneficial early IR transforms. Do not introduce new
|
||||||
/// vector operations.
|
/// vector operations.
|
||||||
bool ScalarizationOnly;
|
bool TryEarlyFoldsOnly;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VectorCombinePass(bool ScalarizationOnly = false)
|
VectorCombinePass(bool TryEarlyFoldsOnly = false)
|
||||||
: ScalarizationOnly(ScalarizationOnly) {}
|
: TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
|
||||||
|
|
||||||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
|
PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
|
||||||
};
|
};
|
||||||
|
|
|
@ -618,7 +618,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
|
||||||
// The matrix extension can introduce large vector operations early, which can
|
// The matrix extension can introduce large vector operations early, which can
|
||||||
// benefit from running vector-combine early on.
|
// benefit from running vector-combine early on.
|
||||||
if (EnableMatrix)
|
if (EnableMatrix)
|
||||||
FPM.addPass(VectorCombinePass(/*ScalarizationOnly=*/true));
|
FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
|
||||||
|
|
||||||
// Eliminate redundancies.
|
// Eliminate redundancies.
|
||||||
FPM.addPass(MergedLoadStoreMotionPass());
|
FPM.addPass(MergedLoadStoreMotionPass());
|
||||||
|
|
|
@ -65,9 +65,9 @@ class VectorCombine {
|
||||||
public:
|
public:
|
||||||
VectorCombine(Function &F, const TargetTransformInfo &TTI,
|
VectorCombine(Function &F, const TargetTransformInfo &TTI,
|
||||||
const DominatorTree &DT, AAResults &AA, AssumptionCache &AC,
|
const DominatorTree &DT, AAResults &AA, AssumptionCache &AC,
|
||||||
bool ScalarizationOnly)
|
bool TryEarlyFoldsOnly)
|
||||||
: F(F), Builder(F.getContext()), TTI(TTI), DT(DT), AA(AA), AC(AC),
|
: F(F), Builder(F.getContext()), TTI(TTI), DT(DT), AA(AA), AC(AC),
|
||||||
ScalarizationOnly(ScalarizationOnly) {}
|
TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
|
||||||
|
|
||||||
bool run();
|
bool run();
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ private:
|
||||||
AAResults &AA;
|
AAResults &AA;
|
||||||
AssumptionCache &AC;
|
AssumptionCache &AC;
|
||||||
|
|
||||||
/// If true only perform scalarization combines and do not introduce new
|
/// If true, only perform beneficial early IR transforms. Do not introduce new
|
||||||
/// vector operations.
|
/// vector operations.
|
||||||
bool ScalarizationOnly;
|
bool TryEarlyFoldsOnly;
|
||||||
|
|
||||||
InstructionWorklist Worklist;
|
InstructionWorklist Worklist;
|
||||||
|
|
||||||
|
@ -1698,7 +1698,7 @@ bool VectorCombine::run() {
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
auto FoldInst = [this, &MadeChange](Instruction &I) {
|
auto FoldInst = [this, &MadeChange](Instruction &I) {
|
||||||
Builder.SetInsertPoint(&I);
|
Builder.SetInsertPoint(&I);
|
||||||
if (!ScalarizationOnly) {
|
if (!TryEarlyFoldsOnly) {
|
||||||
if (isa<FixedVectorType>(I.getType())) {
|
if (isa<FixedVectorType>(I.getType())) {
|
||||||
MadeChange |= vectorizeLoadInsert(I);
|
MadeChange |= vectorizeLoadInsert(I);
|
||||||
MadeChange |= widenSubvectorLoad(I);
|
MadeChange |= widenSubvectorLoad(I);
|
||||||
|
@ -1800,7 +1800,7 @@ PreservedAnalyses VectorCombinePass::run(Function &F,
|
||||||
TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);
|
TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);
|
||||||
DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
|
DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
|
||||||
AAResults &AA = FAM.getResult<AAManager>(F);
|
AAResults &AA = FAM.getResult<AAManager>(F);
|
||||||
VectorCombine Combiner(F, TTI, DT, AA, AC, ScalarizationOnly);
|
VectorCombine Combiner(F, TTI, DT, AA, AC, TryEarlyFoldsOnly);
|
||||||
if (!Combiner.run())
|
if (!Combiner.run())
|
||||||
return PreservedAnalyses::all();
|
return PreservedAnalyses::all();
|
||||||
PreservedAnalyses PA;
|
PreservedAnalyses PA;
|
||||||
|
|
Loading…
Reference in New Issue