Skip to content

Commit

Permalink
[VectorCombine] generalize pass param name for early combines; NFC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rotateright committed Nov 21, 2022
1 parent ed7870c commit 8f337f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions llvm/include/llvm/Transforms/Vectorize/VectorCombine.h
Expand Up @@ -21,13 +21,13 @@ namespace llvm {

/// Optimize scalar/vector interactions in IR using target cost models.
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.
bool ScalarizationOnly;
bool TryEarlyFoldsOnly;

public:
VectorCombinePass(bool ScalarizationOnly = false)
: ScalarizationOnly(ScalarizationOnly) {}
VectorCombinePass(bool TryEarlyFoldsOnly = false)
: TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
};
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Passes/PassBuilderPipelines.cpp
Expand Up @@ -618,7 +618,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
// The matrix extension can introduce large vector operations early, which can
// benefit from running vector-combine early on.
if (EnableMatrix)
FPM.addPass(VectorCombinePass(/*ScalarizationOnly=*/true));
FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));

// Eliminate redundancies.
FPM.addPass(MergedLoadStoreMotionPass());
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/Vectorize/VectorCombine.cpp
Expand Up @@ -65,9 +65,9 @@ class VectorCombine {
public:
VectorCombine(Function &F, const TargetTransformInfo &TTI,
const DominatorTree &DT, AAResults &AA, AssumptionCache &AC,
bool ScalarizationOnly)
bool TryEarlyFoldsOnly)
: F(F), Builder(F.getContext()), TTI(TTI), DT(DT), AA(AA), AC(AC),
ScalarizationOnly(ScalarizationOnly) {}
TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}

bool run();

Expand All @@ -79,9 +79,9 @@ class VectorCombine {
AAResults &AA;
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.
bool ScalarizationOnly;
bool TryEarlyFoldsOnly;

InstructionWorklist Worklist;

Expand Down Expand Up @@ -1698,7 +1698,7 @@ bool VectorCombine::run() {
bool MadeChange = false;
auto FoldInst = [this, &MadeChange](Instruction &I) {
Builder.SetInsertPoint(&I);
if (!ScalarizationOnly) {
if (!TryEarlyFoldsOnly) {
if (isa<FixedVectorType>(I.getType())) {
MadeChange |= vectorizeLoadInsert(I);
MadeChange |= widenSubvectorLoad(I);
Expand Down Expand Up @@ -1800,7 +1800,7 @@ PreservedAnalyses VectorCombinePass::run(Function &F,
TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);
DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(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())
return PreservedAnalyses::all();
PreservedAnalyses PA;
Expand Down

0 comments on commit 8f337f8

Please sign in to comment.