-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[NewPM] Remove GuardWideningLegacyPass #72810
[NewPM] Remove GuardWideningLegacyPass #72810
Conversation
This legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed.
@llvm/pr-subscribers-llvm-transforms Author: Aiden Grossman (boomanaiden154) ChangesThis legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed. Full diff: https://github.com/llvm/llvm-project/pull/72810.diff 5 Files Affected:
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index da38a38b87ebc4d..efd82a260f6fb9d 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -129,8 +129,7 @@ void initializeGCMachineCodeAnalysisPass(PassRegistry&);
void initializeGCModuleInfoPass(PassRegistry&);
void initializeGVNLegacyPassPass(PassRegistry&);
void initializeGlobalMergePass(PassRegistry&);
-void initializeGlobalsAAWrapperPassPass(PassRegistry&);
-void initializeGuardWideningLegacyPassPass(PassRegistry&);
+void initializeGlobalsAAWrapperPassPass(PassRegistry &);
void initializeHardwareLoopsLegacyPass(PassRegistry&);
void initializeMIRProfileLoaderPassPass(PassRegistry &);
void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 3fc90e85c3533e2..91ca10d4c183cce 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -80,7 +80,6 @@ namespace {
(void) llvm::createDomViewerWrapperPassPass();
(void) llvm::createAlwaysInlinerLegacyPass();
(void) llvm::createGlobalsAAWrapperPass();
- (void) llvm::createGuardWideningPass();
(void) llvm::createLoopGuardWideningPass();
(void) llvm::createInstSimplifyLegacyPass();
(void) llvm::createInstructionCombiningPass();
diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h
index 0676f485f3fbcf4..cf29eadbd049206 100644
--- a/llvm/include/llvm/Transforms/Scalar.h
+++ b/llvm/include/llvm/Transforms/Scalar.h
@@ -39,16 +39,6 @@ Pass *createRedundantDbgInstEliminationPass();
//
FunctionPass *createDeadCodeEliminationPass();
-
-//===----------------------------------------------------------------------===//
-//
-// GuardWidening - An optimization over the @llvm.experimental.guard intrinsic
-// that (optimistically) combines multiple guards into one to have fewer checks
-// at runtime.
-//
-FunctionPass *createGuardWideningPass();
-
-
//===----------------------------------------------------------------------===//
//
// LoopGuardWidening - Analogous to the GuardWidening pass, but restricted to a
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
index e6eccb4fbafd3e1..0dd99f45f670d13 100644
--- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp
+++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
@@ -1015,40 +1015,7 @@ PreservedAnalyses GuardWideningPass::run(Loop &L, LoopAnalysisManager &AM,
}
namespace {
-struct GuardWideningLegacyPass : public FunctionPass {
- static char ID;
-
- GuardWideningLegacyPass() : FunctionPass(ID) {
- initializeGuardWideningLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override {
- if (skipFunction(F))
- return false;
- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
- auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
- auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
- auto *MSSAWP = getAnalysisIfAvailable<MemorySSAWrapperPass>();
- std::unique_ptr<MemorySSAUpdater> MSSAU;
- if (MSSAWP)
- MSSAU = std::make_unique<MemorySSAUpdater>(&MSSAWP->getMSSA());
- return GuardWideningImpl(DT, &PDT, LI, AC, MSSAU ? MSSAU.get() : nullptr,
- DT.getRootNode(),
- [](BasicBlock *) { return true; })
- .run();
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesCFG();
- AU.addRequired<DominatorTreeWrapperPass>();
- AU.addRequired<PostDominatorTreeWrapperPass>();
- AU.addRequired<LoopInfoWrapperPass>();
- AU.addPreserved<MemorySSAWrapperPass>();
- }
-};
-
-/// Same as above, but restricted to a single loop at a time. Can be
+/// Restricted to a single loop at a time. Can be
/// scheduled with other loop passes w/o breaking out of LPM
struct LoopGuardWideningLegacyPass : public LoopPass {
static char ID;
@@ -1091,17 +1058,8 @@ struct LoopGuardWideningLegacyPass : public LoopPass {
};
}
-char GuardWideningLegacyPass::ID = 0;
char LoopGuardWideningLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(GuardWideningLegacyPass, "guard-widening", "Widen guards",
- false, false)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_END(GuardWideningLegacyPass, "guard-widening", "Widen guards",
- false, false)
-
INITIALIZE_PASS_BEGIN(LoopGuardWideningLegacyPass, "loop-guard-widening",
"Widen guards (within a single loop, as a loop pass)",
false, false)
@@ -1112,10 +1070,6 @@ INITIALIZE_PASS_END(LoopGuardWideningLegacyPass, "loop-guard-widening",
"Widen guards (within a single loop, as a loop pass)",
false, false)
-FunctionPass *llvm::createGuardWideningPass() {
- return new GuardWideningLegacyPass();
-}
-
Pass *llvm::createLoopGuardWideningPass() {
return new LoopGuardWideningLegacyPass();
}
diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp
index 11bb8e936b74e7c..df402f260a1f64b 100644
--- a/llvm/lib/Transforms/Scalar/Scalar.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp
@@ -22,7 +22,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
initializeConstantHoistingLegacyPassPass(Registry);
initializeDCELegacyPassPass(Registry);
initializeScalarizerLegacyPassPass(Registry);
- initializeGuardWideningLegacyPassPass(Registry);
initializeLoopGuardWideningLegacyPassPass(Registry);
initializeGVNLegacyPassPass(Registry);
initializeEarlyCSELegacyPassPass(Registry);
|
You can test this locally with the following command:git-clang-format --diff 5860d248a780aaef860db3d54184b49fc758c3c1 680dfebe69cb3976819aa5fc93100d839c182228 -- llvm/include/llvm/InitializePasses.h llvm/include/llvm/LinkAllPasses.h llvm/include/llvm/Transforms/Scalar.h llvm/lib/Transforms/Scalar/GuardWidening.cpp llvm/lib/Transforms/Scalar/Scalar.cpp View the diff from clang-format here.diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 91ca10d4c1..c16b2e5f1e 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -79,7 +79,7 @@ namespace {
(void) llvm::createDomOnlyViewerWrapperPassPass();
(void) llvm::createDomViewerWrapperPassPass();
(void) llvm::createAlwaysInlinerLegacyPass();
- (void) llvm::createGlobalsAAWrapperPass();
+ (void)llvm::createGlobalsAAWrapperPass();
(void) llvm::createLoopGuardWideningPass();
(void) llvm::createInstSimplifyLegacyPass();
(void) llvm::createInstructionCombiningPass();
|
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
This legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed.
This legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed.
This legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed.