Skip to content

Commit 8f337f8

Browse files
committed
[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.
1 parent ed7870c commit 8f337f8

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

llvm/include/llvm/Transforms/Vectorize/VectorCombine.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ namespace llvm {
2121

2222
/// Optimize scalar/vector interactions in IR using target cost models.
2323
class VectorCombinePass : public PassInfoMixin<VectorCombinePass> {
24-
/// If true only perform scalarization combines and do not introduce new
24+
/// If true, only perform beneficial early IR transforms. Do not introduce new
2525
/// vector operations.
26-
bool ScalarizationOnly;
26+
bool TryEarlyFoldsOnly;
2727

2828
public:
29-
VectorCombinePass(bool ScalarizationOnly = false)
30-
: ScalarizationOnly(ScalarizationOnly) {}
29+
VectorCombinePass(bool TryEarlyFoldsOnly = false)
30+
: TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
3131

3232
PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
3333
};

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
618618
// The matrix extension can introduce large vector operations early, which can
619619
// benefit from running vector-combine early on.
620620
if (EnableMatrix)
621-
FPM.addPass(VectorCombinePass(/*ScalarizationOnly=*/true));
621+
FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
622622

623623
// Eliminate redundancies.
624624
FPM.addPass(MergedLoadStoreMotionPass());

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ class VectorCombine {
6565
public:
6666
VectorCombine(Function &F, const TargetTransformInfo &TTI,
6767
const DominatorTree &DT, AAResults &AA, AssumptionCache &AC,
68-
bool ScalarizationOnly)
68+
bool TryEarlyFoldsOnly)
6969
: F(F), Builder(F.getContext()), TTI(TTI), DT(DT), AA(AA), AC(AC),
70-
ScalarizationOnly(ScalarizationOnly) {}
70+
TryEarlyFoldsOnly(TryEarlyFoldsOnly) {}
7171

7272
bool run();
7373

@@ -79,9 +79,9 @@ class VectorCombine {
7979
AAResults &AA;
8080
AssumptionCache &AC;
8181

82-
/// If true only perform scalarization combines and do not introduce new
82+
/// If true, only perform beneficial early IR transforms. Do not introduce new
8383
/// vector operations.
84-
bool ScalarizationOnly;
84+
bool TryEarlyFoldsOnly;
8585

8686
InstructionWorklist Worklist;
8787

@@ -1698,7 +1698,7 @@ bool VectorCombine::run() {
16981698
bool MadeChange = false;
16991699
auto FoldInst = [this, &MadeChange](Instruction &I) {
17001700
Builder.SetInsertPoint(&I);
1701-
if (!ScalarizationOnly) {
1701+
if (!TryEarlyFoldsOnly) {
17021702
if (isa<FixedVectorType>(I.getType())) {
17031703
MadeChange |= vectorizeLoadInsert(I);
17041704
MadeChange |= widenSubvectorLoad(I);
@@ -1800,7 +1800,7 @@ PreservedAnalyses VectorCombinePass::run(Function &F,
18001800
TargetTransformInfo &TTI = FAM.getResult<TargetIRAnalysis>(F);
18011801
DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
18021802
AAResults &AA = FAM.getResult<AAManager>(F);
1803-
VectorCombine Combiner(F, TTI, DT, AA, AC, ScalarizationOnly);
1803+
VectorCombine Combiner(F, TTI, DT, AA, AC, TryEarlyFoldsOnly);
18041804
if (!Combiner.run())
18051805
return PreservedAnalyses::all();
18061806
PreservedAnalyses PA;

0 commit comments

Comments
 (0)