-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Passes] Generalize ShouldRunExtraVectorPasses to allow re-use (NFCI). #118323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-ir Author: Florian Hahn (fhahn) ChangesGeneralize ShouldRunExtraVectorPasses toj ShouldRunExtraPasses, to allow re-use for other transformations. I intend to use this to let LowerMatrixIntrinsicsPass request EarlyCSE if there are any matrix constructs to lower. This should allow enabling LowerMatrixIntrinsics without a noticable compile-time hit. Full diff: https://github.com/llvm/llvm-project/pull/118323.diff 6 Files Affected:
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index 5dab9d0d0a7979..91730301bbd415 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -935,6 +935,38 @@ struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
}
};
+/// A marker analyss to determine if extra passes should be run on demand.
+/// Passes requesting extra transformations to run need to request and preserve
+/// this analysis.
+struct ShouldRunExtraPasses : public AnalysisInfoMixin<ShouldRunExtraPasses> {
+ static AnalysisKey Key;
+ struct Result {
+ bool invalidate(Function &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &) {
+ // Check whether the analysis has been explicitly invalidated. Otherwise,
+ // it remains preserved.
+ auto PAC = PA.getChecker<ShouldRunExtraPasses>();
+ return !PAC.preservedWhenStateless();
+ }
+ };
+
+ Result run(Function &F, FunctionAnalysisManager &FAM) { return Result(); }
+};
+
+/// A pass manager to run a set of extra function passes if the
+/// ShouldRunExtraPasses marker analysis is present. This allows passes to
+/// request additional transformations on demand. An example is extra
+/// simplifications after loop-vectorization, if runtime checks have been added.
+struct ExtraPassManager : public FunctionPassManager {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
+ auto PA = PreservedAnalyses::all();
+ if (AM.getCachedResult<ShouldRunExtraPasses>(F))
+ PA.intersect(FunctionPassManager::run(F, AM));
+ PA.abandon<ShouldRunExtraPasses>();
+ return PA;
+ }
+};
+
} // end namespace llvm
#endif // LLVM_IR_PASSMANAGER_H
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
index 24b6354662955e..9256cf16c0157e 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
@@ -80,38 +80,6 @@ class TargetTransformInfo;
extern cl::opt<bool> EnableLoopInterleaving;
extern cl::opt<bool> EnableLoopVectorization;
-/// A marker to determine if extra passes after loop vectorization should be
-/// run.
-struct ShouldRunExtraVectorPasses
- : public AnalysisInfoMixin<ShouldRunExtraVectorPasses> {
- static AnalysisKey Key;
- struct Result {
- bool invalidate(Function &F, const PreservedAnalyses &PA,
- FunctionAnalysisManager::Invalidator &) {
- // Check whether the analysis has been explicitly invalidated. Otherwise,
- // it remains preserved.
- auto PAC = PA.getChecker<ShouldRunExtraVectorPasses>();
- return !PAC.preservedWhenStateless();
- }
- };
-
- Result run(Function &F, FunctionAnalysisManager &FAM) { return Result(); }
-};
-
-/// A pass manager to run a set of extra function simplification passes after
-/// vectorization, if requested. LoopVectorize caches the
-/// ShouldRunExtraVectorPasses analysis to request extra simplifications, if
-/// they could be beneficial.
-struct ExtraVectorPassManager : public FunctionPassManager {
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
- auto PA = PreservedAnalyses::all();
- if (AM.getCachedResult<ShouldRunExtraVectorPasses>(F))
- PA.intersect(FunctionPassManager::run(F, AM));
- PA.abandon<ShouldRunExtraVectorPasses>();
- return PA;
- }
-};
-
struct LoopVectorizeOptions {
/// If false, consider all loops for interleaving.
/// If true, only loops that explicitly request interleaving are considered.
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index bf8f7906d3368d..4990695108fc70 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -160,3 +160,5 @@ void llvm::printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
AnalysisSetKey CFGAnalyses::SetKey;
AnalysisSetKey PreservedAnalyses::AllAnalysesKey;
+
+AnalysisKey ShouldRunExtraPasses::Key;
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 5a7c327de95870..5a8c60adccee34 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1306,8 +1306,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
// Cleanup after the loop optimization passes.
FPM.addPass(InstCombinePass());
+ ExtraPassManager ExtraPasses;
if (Level.getSpeedupLevel() > 1 && ExtraVectorizerPasses) {
- ExtraVectorPassManager ExtraPasses;
// At higher optimization levels, try to clean up any runtime overlap and
// alignment checks inserted by the vectorizer. We want to track correlated
// runtime checks for two inner loops in the same outer loop, fold any
@@ -1328,8 +1328,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
ExtraPasses.addPass(
SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
ExtraPasses.addPass(InstCombinePass());
- FPM.addPass(std::move(ExtraPasses));
}
+ FPM.addPass(std::move(ExtraPasses));
// Now that we've formed fast to execute loop structures, we do further
// optimizations. These are run afterward as they might block doing complex
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 7c3798f6462a46..260fbae1d2f87d 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -303,8 +303,8 @@ FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
FUNCTION_ANALYSIS("should-not-run-function-passes",
ShouldNotRunFunctionPassesAnalysis())
-FUNCTION_ANALYSIS("should-run-extra-vector-passes",
- ShouldRunExtraVectorPasses())
+FUNCTION_ANALYSIS("should-run-extra-passes",
+ ShouldRunExtraPasses())
FUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis())
FUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
FUNCTION_ANALYSIS("target-ir",
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 90312c1a28df3c..2ce293889e88e4 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -442,8 +442,6 @@ using SCEV2ValueTy = DenseMap<const SCEV *, Value *>;
namespace llvm {
-AnalysisKey ShouldRunExtraVectorPasses::Key;
-
/// InnerLoopVectorizer vectorizes loops which contain only one basic
/// block to a specified vectorization factor (VF).
/// This class performs the widening of scalars into vectors, or multiple
@@ -10476,8 +10474,8 @@ PreservedAnalyses LoopVectorizePass::run(Function &F,
// 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>();
+ AM.getResult<ShouldRunExtraPasses>(F);
+ PA.preserve<ShouldRunExtraPasses>();
} else {
PA.preserveSet<CFGAnalyses>();
}
|
@llvm/pr-subscribers-vectorizers Author: Florian Hahn (fhahn) ChangesGeneralize ShouldRunExtraVectorPasses toj ShouldRunExtraPasses, to allow re-use for other transformations. I intend to use this to let LowerMatrixIntrinsicsPass request EarlyCSE if there are any matrix constructs to lower. This should allow enabling LowerMatrixIntrinsics without a noticable compile-time hit. Full diff: https://github.com/llvm/llvm-project/pull/118323.diff 6 Files Affected:
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index 5dab9d0d0a7979..91730301bbd415 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -935,6 +935,38 @@ struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
}
};
+/// A marker analyss to determine if extra passes should be run on demand.
+/// Passes requesting extra transformations to run need to request and preserve
+/// this analysis.
+struct ShouldRunExtraPasses : public AnalysisInfoMixin<ShouldRunExtraPasses> {
+ static AnalysisKey Key;
+ struct Result {
+ bool invalidate(Function &F, const PreservedAnalyses &PA,
+ FunctionAnalysisManager::Invalidator &) {
+ // Check whether the analysis has been explicitly invalidated. Otherwise,
+ // it remains preserved.
+ auto PAC = PA.getChecker<ShouldRunExtraPasses>();
+ return !PAC.preservedWhenStateless();
+ }
+ };
+
+ Result run(Function &F, FunctionAnalysisManager &FAM) { return Result(); }
+};
+
+/// A pass manager to run a set of extra function passes if the
+/// ShouldRunExtraPasses marker analysis is present. This allows passes to
+/// request additional transformations on demand. An example is extra
+/// simplifications after loop-vectorization, if runtime checks have been added.
+struct ExtraPassManager : public FunctionPassManager {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
+ auto PA = PreservedAnalyses::all();
+ if (AM.getCachedResult<ShouldRunExtraPasses>(F))
+ PA.intersect(FunctionPassManager::run(F, AM));
+ PA.abandon<ShouldRunExtraPasses>();
+ return PA;
+ }
+};
+
} // end namespace llvm
#endif // LLVM_IR_PASSMANAGER_H
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
index 24b6354662955e..9256cf16c0157e 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
@@ -80,38 +80,6 @@ class TargetTransformInfo;
extern cl::opt<bool> EnableLoopInterleaving;
extern cl::opt<bool> EnableLoopVectorization;
-/// A marker to determine if extra passes after loop vectorization should be
-/// run.
-struct ShouldRunExtraVectorPasses
- : public AnalysisInfoMixin<ShouldRunExtraVectorPasses> {
- static AnalysisKey Key;
- struct Result {
- bool invalidate(Function &F, const PreservedAnalyses &PA,
- FunctionAnalysisManager::Invalidator &) {
- // Check whether the analysis has been explicitly invalidated. Otherwise,
- // it remains preserved.
- auto PAC = PA.getChecker<ShouldRunExtraVectorPasses>();
- return !PAC.preservedWhenStateless();
- }
- };
-
- Result run(Function &F, FunctionAnalysisManager &FAM) { return Result(); }
-};
-
-/// A pass manager to run a set of extra function simplification passes after
-/// vectorization, if requested. LoopVectorize caches the
-/// ShouldRunExtraVectorPasses analysis to request extra simplifications, if
-/// they could be beneficial.
-struct ExtraVectorPassManager : public FunctionPassManager {
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
- auto PA = PreservedAnalyses::all();
- if (AM.getCachedResult<ShouldRunExtraVectorPasses>(F))
- PA.intersect(FunctionPassManager::run(F, AM));
- PA.abandon<ShouldRunExtraVectorPasses>();
- return PA;
- }
-};
-
struct LoopVectorizeOptions {
/// If false, consider all loops for interleaving.
/// If true, only loops that explicitly request interleaving are considered.
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index bf8f7906d3368d..4990695108fc70 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -160,3 +160,5 @@ void llvm::printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
AnalysisSetKey CFGAnalyses::SetKey;
AnalysisSetKey PreservedAnalyses::AllAnalysesKey;
+
+AnalysisKey ShouldRunExtraPasses::Key;
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 5a7c327de95870..5a8c60adccee34 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1306,8 +1306,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
// Cleanup after the loop optimization passes.
FPM.addPass(InstCombinePass());
+ ExtraPassManager ExtraPasses;
if (Level.getSpeedupLevel() > 1 && ExtraVectorizerPasses) {
- ExtraVectorPassManager ExtraPasses;
// At higher optimization levels, try to clean up any runtime overlap and
// alignment checks inserted by the vectorizer. We want to track correlated
// runtime checks for two inner loops in the same outer loop, fold any
@@ -1328,8 +1328,8 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
ExtraPasses.addPass(
SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
ExtraPasses.addPass(InstCombinePass());
- FPM.addPass(std::move(ExtraPasses));
}
+ FPM.addPass(std::move(ExtraPasses));
// Now that we've formed fast to execute loop structures, we do further
// optimizations. These are run afterward as they might block doing complex
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 7c3798f6462a46..260fbae1d2f87d 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -303,8 +303,8 @@ FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
FUNCTION_ANALYSIS("should-not-run-function-passes",
ShouldNotRunFunctionPassesAnalysis())
-FUNCTION_ANALYSIS("should-run-extra-vector-passes",
- ShouldRunExtraVectorPasses())
+FUNCTION_ANALYSIS("should-run-extra-passes",
+ ShouldRunExtraPasses())
FUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis())
FUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
FUNCTION_ANALYSIS("target-ir",
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 90312c1a28df3c..2ce293889e88e4 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -442,8 +442,6 @@ using SCEV2ValueTy = DenseMap<const SCEV *, Value *>;
namespace llvm {
-AnalysisKey ShouldRunExtraVectorPasses::Key;
-
/// InnerLoopVectorizer vectorizes loops which contain only one basic
/// block to a specified vectorization factor (VF).
/// This class performs the widening of scalars into vectors, or multiple
@@ -10476,8 +10474,8 @@ PreservedAnalyses LoopVectorizePass::run(Function &F,
// 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>();
+ AM.getResult<ShouldRunExtraPasses>(F);
+ PA.preserve<ShouldRunExtraPasses>();
} else {
PA.preserveSet<CFGAnalyses>();
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about reusing a single, unparameterized marker analysis for multiple extra pass managers.
llvm/include/llvm/IR/PassManager.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be part of PassManager.h, which is widely included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate file (llvm/Transforms/Utils/ExtraPassManager), but maybe there's a better place or name?
llvm/include/llvm/IR/PassManager.h
Outdated
@@ -935,6 +935,38 @@ struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> { | |||
} | |||
}; | |||
|
|||
/// A marker analyss to determine if extra passes should be run on demand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// A marker analyss to determine if extra passes should be run on demand. | |
/// A marker analysis to determine if extra passes should be run on demand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
} | ||
FPM.addPass(std::move(ExtraPasses)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this move?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a consequence of using a single marker, this required the pass manager to run unconditionally to clear the marker set by LV.
cb6f7b9
to
ab05874
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
ab05874
to
b91287d
Compare
Updated to require each use to create their own marker analysis, not sure if there's a nicer way to avoid some of the extra boilerplate (although it is quite minimal) |
@@ -0,0 +1,56 @@ | |||
//===- ExtraPassManager.h - Loop pass management -----------------*- C++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied header comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, missed that. Updated thanks!
/// request additional transformations on demand. An example is extra | ||
/// simplifications after loop-vectorization, if runtime checks have been added. | ||
template <typename MarkerTy> | ||
struct ExtraPassManager : public FunctionPassManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct ExtraPassManager : public FunctionPassManager { | |
struct ExtraFunctionPassManager : public FunctionPassManager { |
I assume the reason that this doesn't cover the extra LoopUnswitch run is that that one needs an LPM instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might still make sense to also move the LPM variant here as well? It can at least use the same ShouldRunExtraPasses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, update the name and moved ExtraLoopPassManager
here as well. Extended ShouldRunExtraPasses
to support Loops as well
@@ -201,6 +170,13 @@ void reportVectorizationFailure(const StringRef DebugMsg, | |||
const StringRef OREMsg, const StringRef ORETag, | |||
OptimizationRemarkEmitter *ORE, Loop *TheLoop, Instruction *I = nullptr); | |||
|
|||
/// A marker analyss to determine if extra passes should be run after loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// A marker analyss to determine if extra passes should be run after loop | |
/// A marker analysis to determine if extra passes should be run after loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
@@ -134,6 +134,7 @@ | |||
#include "llvm/Support/NativeFormatting.h" | |||
#include "llvm/Support/raw_ostream.h" | |||
#include "llvm/Transforms/Utils/BasicBlockUtils.h" | |||
#include "llvm/Transforms/Utils/ExtraPassManager.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this include needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, thanks!
9163f47
to
c7772d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
public AnalysisInfoMixin<ShouldRunExtraSimpleLoopUnswitch> { | ||
static AnalysisKey Key; | ||
|
||
static bool isRequired() { return true; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this isRequired? I thought that's only relevant for passes.
//===- ExtraFunctionPassManager.h - Run Optimizations on Demand ---------*- C++ | ||
//-*-===// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to avoid the odd line break here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, I thought I already fixed this up....
//===- ExtraFunctionPassManager.h - Run Optimizations on Demand ---------*- C++ | ||
//-*-===// | ||
// | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two empty lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line now, thanks
return PA; | ||
} | ||
|
||
static bool isRequired() { return true; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this should either be on both or neither. I'd expect this to be inherited from FunctionPassManager/LoopPassManager, but maybe my C++-foo is too weak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be needed, removed ,thanks
Generalize ShouldRunExtraVectorPasses toj ShouldRunExtraPasses, to allow re-use for other transformations. I intend to use this to let LowerMatrixIntrinsicsPass request EarlyCSE if there are any matrix constructs to lower. This should allow enabling LowerMatrixIntrinsics without a noticable compile-time hit.
55205b2
to
ddc5037
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glad to see this sort of thing, one comment though
/// request additional transformations on demand. An example is extra | ||
/// simplifications after loop-vectorization, if runtime checks have been added. | ||
template <typename MarkerTy> | ||
struct ExtraFunctionPassManager : public FunctionPassManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new pass manager data structures very much do not endorse overriding methods via inheritance. I'd prefer ExtraFunctionPassManager
to have a FunctionPassManager
member instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put up #119348, is that what you had in mind?
As suggested post-commit for llvm#118323, adjust the extra pass managers to no inherit from Function/LoopPassManager, but manage the extra passes via member pass managers.
As suggested post-commit for llvm#118323, adjust the extra pass managers to no inherit from Function/LoopPassManager, but manage the extra passes via member pass managers.
Generalize ShouldRunExtraVectorPasses toj ShouldRunExtraPasses, to allow re-use for other transformations. I intend to use this to let LowerMatrixIntrinsicsPass request EarlyCSE if there are any matrix constructs to lower. This should allow enabling LowerMatrixIntrinsics without a noticable compile-time hit.