Skip to content

Commit b9975ce

Browse files
[NewPM] Remove LoopSinkLegacy Pass (#72811)
This pass isn't used anywhere and thus has no test coverage. For these reasons, remove it.
1 parent d715e2c commit b9975ce

File tree

5 files changed

+0
-67
lines changed

5 files changed

+0
-67
lines changed

llvm/include/llvm/InitializePasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ void initializeLazyMachineBlockFrequencyInfoPassPass(PassRegistry&);
157157
void initializeLazyValueInfoPrinterPass(PassRegistry&);
158158
void initializeLazyValueInfoWrapperPassPass(PassRegistry&);
159159
void initializeLegacyLICMPassPass(PassRegistry&);
160-
void initializeLegacyLoopSinkPassPass(PassRegistry&);
161160
void initializeLegalizerPass(PassRegistry&);
162161
void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &);
163162
void initializeGISelKnownBitsAnalysisPass(PassRegistry &);

llvm/include/llvm/LinkAllPasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ namespace {
8787
(void) llvm::createKCFIPass();
8888
(void) llvm::createLCSSAPass();
8989
(void) llvm::createLICMPass();
90-
(void) llvm::createLoopSinkPass();
9190
(void) llvm::createLazyValueInfoPass();
9291
(void) llvm::createLoopExtractorPass();
9392
(void) llvm::createLoopPredicationPass();

llvm/include/llvm/Transforms/Scalar.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ FunctionPass *createSROAPass(bool PreserveCFG = true);
6161
//
6262
Pass *createLICMPass();
6363

64-
//===----------------------------------------------------------------------===//
65-
//
66-
// LoopSink - This pass sinks invariants from preheader to loop body where
67-
// frequency is lower than loop preheader.
68-
//
69-
Pass *createLoopSinkPass();
70-
7164
//===----------------------------------------------------------------------===//
7265
//
7366
// LoopPredication - This pass does loop predication on guards.

llvm/lib/Transforms/Scalar/LoopSink.cpp

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@
3636
#include "llvm/Analysis/AliasAnalysis.h"
3737
#include "llvm/Analysis/BlockFrequencyInfo.h"
3838
#include "llvm/Analysis/LoopInfo.h"
39-
#include "llvm/Analysis/LoopPass.h"
4039
#include "llvm/Analysis/MemorySSA.h"
4140
#include "llvm/Analysis/MemorySSAUpdater.h"
4241
#include "llvm/Analysis/ScalarEvolution.h"
4342
#include "llvm/IR/Dominators.h"
4443
#include "llvm/IR/Instructions.h"
45-
#include "llvm/InitializePasses.h"
4644
#include "llvm/Support/BranchProbability.h"
4745
#include "llvm/Support/CommandLine.h"
4846
#include "llvm/Transforms/Scalar.h"
@@ -390,58 +388,3 @@ PreservedAnalyses LoopSinkPass::run(Function &F, FunctionAnalysisManager &FAM) {
390388

391389
return PA;
392390
}
393-
394-
namespace {
395-
struct LegacyLoopSinkPass : public LoopPass {
396-
static char ID;
397-
LegacyLoopSinkPass() : LoopPass(ID) {
398-
initializeLegacyLoopSinkPassPass(*PassRegistry::getPassRegistry());
399-
}
400-
401-
bool runOnLoop(Loop *L, LPPassManager &LPM) override {
402-
if (skipLoop(L))
403-
return false;
404-
405-
BasicBlock *Preheader = L->getLoopPreheader();
406-
if (!Preheader)
407-
return false;
408-
409-
// Enable LoopSink only when runtime profile is available.
410-
// With static profile, the sinking decision may be sub-optimal.
411-
if (!Preheader->getParent()->hasProfileData())
412-
return false;
413-
414-
AAResults &AA = getAnalysis<AAResultsWrapperPass>().getAAResults();
415-
MemorySSA &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA();
416-
auto *SE = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
417-
bool Changed = sinkLoopInvariantInstructions(
418-
*L, AA, getAnalysis<LoopInfoWrapperPass>().getLoopInfo(),
419-
getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
420-
getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI(),
421-
MSSA, SE ? &SE->getSE() : nullptr);
422-
423-
if (VerifyMemorySSA)
424-
MSSA.verifyMemorySSA();
425-
426-
return Changed;
427-
}
428-
429-
void getAnalysisUsage(AnalysisUsage &AU) const override {
430-
AU.setPreservesCFG();
431-
AU.addRequired<BlockFrequencyInfoWrapperPass>();
432-
getLoopAnalysisUsage(AU);
433-
AU.addRequired<MemorySSAWrapperPass>();
434-
AU.addPreserved<MemorySSAWrapperPass>();
435-
}
436-
};
437-
}
438-
439-
char LegacyLoopSinkPass::ID = 0;
440-
INITIALIZE_PASS_BEGIN(LegacyLoopSinkPass, "loop-sink", "Loop Sink", false,
441-
false)
442-
INITIALIZE_PASS_DEPENDENCY(LoopPass)
443-
INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfoWrapperPass)
444-
INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
445-
INITIALIZE_PASS_END(LegacyLoopSinkPass, "loop-sink", "Loop Sink", false, false)
446-
447-
Pass *llvm::createLoopSinkPass() { return new LegacyLoopSinkPass(); }

llvm/lib/Transforms/Scalar/Scalar.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
3131
initializeInferAddressSpacesPass(Registry);
3232
initializeInstSimplifyLegacyPassPass(Registry);
3333
initializeLegacyLICMPassPass(Registry);
34-
initializeLegacyLoopSinkPassPass(Registry);
3534
initializeLoopDataPrefetchLegacyPassPass(Registry);
3635
initializeLoopInstSimplifyLegacyPassPass(Registry);
3736
initializeLoopPredicationLegacyPassPass(Registry);

0 commit comments

Comments
 (0)