Skip to content

Commit d715e2c

Browse files
[NewPM] Remove GuardWideningLegacyPass (#72810)
This legacy pass isn't used anywhere and there is no test coverage, so at this point it should be removed.
1 parent bf897d5 commit d715e2c

File tree

5 files changed

+2
-61
lines changed

5 files changed

+2
-61
lines changed

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ void initializeGCMachineCodeAnalysisPass(PassRegistry&);
129129
void initializeGCModuleInfoPass(PassRegistry&);
130130
void initializeGVNLegacyPassPass(PassRegistry&);
131131
void initializeGlobalMergePass(PassRegistry&);
132-
void initializeGlobalsAAWrapperPassPass(PassRegistry&);
133-
void initializeGuardWideningLegacyPassPass(PassRegistry&);
132+
void initializeGlobalsAAWrapperPassPass(PassRegistry &);
134133
void initializeHardwareLoopsLegacyPass(PassRegistry&);
135134
void initializeMIRProfileLoaderPassPass(PassRegistry &);
136135
void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry&);

llvm/include/llvm/LinkAllPasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ namespace {
8080
(void) llvm::createDomViewerWrapperPassPass();
8181
(void) llvm::createAlwaysInlinerLegacyPass();
8282
(void) llvm::createGlobalsAAWrapperPass();
83-
(void) llvm::createGuardWideningPass();
8483
(void) llvm::createLoopGuardWideningPass();
8584
(void) llvm::createInstSimplifyLegacyPass();
8685
(void) llvm::createInstructionCombiningPass();

llvm/include/llvm/Transforms/Scalar.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ Pass *createRedundantDbgInstEliminationPass();
3939
//
4040
FunctionPass *createDeadCodeEliminationPass();
4141

42-
43-
//===----------------------------------------------------------------------===//
44-
//
45-
// GuardWidening - An optimization over the @llvm.experimental.guard intrinsic
46-
// that (optimistically) combines multiple guards into one to have fewer checks
47-
// at runtime.
48-
//
49-
FunctionPass *createGuardWideningPass();
50-
51-
5242
//===----------------------------------------------------------------------===//
5343
//
5444
// LoopGuardWidening - Analogous to the GuardWidening pass, but restricted to a

llvm/lib/Transforms/Scalar/GuardWidening.cpp

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,40 +1015,7 @@ PreservedAnalyses GuardWideningPass::run(Loop &L, LoopAnalysisManager &AM,
10151015
}
10161016

10171017
namespace {
1018-
struct GuardWideningLegacyPass : public FunctionPass {
1019-
static char ID;
1020-
1021-
GuardWideningLegacyPass() : FunctionPass(ID) {
1022-
initializeGuardWideningLegacyPassPass(*PassRegistry::getPassRegistry());
1023-
}
1024-
1025-
bool runOnFunction(Function &F) override {
1026-
if (skipFunction(F))
1027-
return false;
1028-
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
1029-
auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
1030-
auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
1031-
auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
1032-
auto *MSSAWP = getAnalysisIfAvailable<MemorySSAWrapperPass>();
1033-
std::unique_ptr<MemorySSAUpdater> MSSAU;
1034-
if (MSSAWP)
1035-
MSSAU = std::make_unique<MemorySSAUpdater>(&MSSAWP->getMSSA());
1036-
return GuardWideningImpl(DT, &PDT, LI, AC, MSSAU ? MSSAU.get() : nullptr,
1037-
DT.getRootNode(),
1038-
[](BasicBlock *) { return true; })
1039-
.run();
1040-
}
1041-
1042-
void getAnalysisUsage(AnalysisUsage &AU) const override {
1043-
AU.setPreservesCFG();
1044-
AU.addRequired<DominatorTreeWrapperPass>();
1045-
AU.addRequired<PostDominatorTreeWrapperPass>();
1046-
AU.addRequired<LoopInfoWrapperPass>();
1047-
AU.addPreserved<MemorySSAWrapperPass>();
1048-
}
1049-
};
1050-
1051-
/// Same as above, but restricted to a single loop at a time. Can be
1018+
/// Restricted to a single loop at a time. Can be
10521019
/// scheduled with other loop passes w/o breaking out of LPM
10531020
struct LoopGuardWideningLegacyPass : public LoopPass {
10541021
static char ID;
@@ -1091,17 +1058,8 @@ struct LoopGuardWideningLegacyPass : public LoopPass {
10911058
};
10921059
}
10931060

1094-
char GuardWideningLegacyPass::ID = 0;
10951061
char LoopGuardWideningLegacyPass::ID = 0;
10961062

1097-
INITIALIZE_PASS_BEGIN(GuardWideningLegacyPass, "guard-widening", "Widen guards",
1098-
false, false)
1099-
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
1100-
INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
1101-
INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
1102-
INITIALIZE_PASS_END(GuardWideningLegacyPass, "guard-widening", "Widen guards",
1103-
false, false)
1104-
11051063
INITIALIZE_PASS_BEGIN(LoopGuardWideningLegacyPass, "loop-guard-widening",
11061064
"Widen guards (within a single loop, as a loop pass)",
11071065
false, false)
@@ -1112,10 +1070,6 @@ INITIALIZE_PASS_END(LoopGuardWideningLegacyPass, "loop-guard-widening",
11121070
"Widen guards (within a single loop, as a loop pass)",
11131071
false, false)
11141072

1115-
FunctionPass *llvm::createGuardWideningPass() {
1116-
return new GuardWideningLegacyPass();
1117-
}
1118-
11191073
Pass *llvm::createLoopGuardWideningPass() {
11201074
return new LoopGuardWideningLegacyPass();
11211075
}

llvm/lib/Transforms/Scalar/Scalar.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
2222
initializeConstantHoistingLegacyPassPass(Registry);
2323
initializeDCELegacyPassPass(Registry);
2424
initializeScalarizerLegacyPassPass(Registry);
25-
initializeGuardWideningLegacyPassPass(Registry);
2625
initializeLoopGuardWideningLegacyPassPass(Registry);
2726
initializeGVNLegacyPassPass(Registry);
2827
initializeEarlyCSELegacyPassPass(Registry);

0 commit comments

Comments
 (0)