Skip to content

Commit 40c60c0

Browse files
committed
[Passes] Remove the legacy DemandedBitsWrapperPass
Last user of DemandedBitsWrapperPass was the BDCE pass. Since the legacy PM version of BDCE was removed in an earlier commit, this patch removes the now unused DemandedBitsWrapperPass. Differential Revision: https://reviews.llvm.org/D148336
1 parent fb93f98 commit 40c60c0

File tree

6 files changed

+0
-69
lines changed

6 files changed

+0
-69
lines changed

llvm/include/llvm/Analysis/DemandedBits.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "llvm/ADT/DenseMap.h"
2626
#include "llvm/ADT/SmallPtrSet.h"
2727
#include "llvm/IR/PassManager.h"
28-
#include "llvm/Pass.h"
2928
#include <optional>
3029

3130
namespace llvm {
@@ -99,26 +98,6 @@ class DemandedBits {
9998
SmallPtrSet<Use *, 16> DeadUses;
10099
};
101100

102-
class DemandedBitsWrapperPass : public FunctionPass {
103-
private:
104-
mutable std::optional<DemandedBits> DB;
105-
106-
public:
107-
static char ID; // Pass identification, replacement for typeid
108-
109-
DemandedBitsWrapperPass();
110-
111-
bool runOnFunction(Function &F) override;
112-
void getAnalysisUsage(AnalysisUsage &AU) const override;
113-
114-
/// Clean up memory in between runs
115-
void releaseMemory() override;
116-
117-
DemandedBits &getDemandedBits() { return *DB; }
118-
119-
void print(raw_ostream &OS, const Module *M) const override;
120-
};
121-
122101
/// An analysis that produces \c DemandedBits for a function.
123102
class DemandedBitsAnalysis : public AnalysisInfoMixin<DemandedBitsAnalysis> {
124103
friend AnalysisInfoMixin<DemandedBitsAnalysis>;
@@ -144,9 +123,6 @@ class DemandedBitsPrinterPass : public PassInfoMixin<DemandedBitsPrinterPass> {
144123
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
145124
};
146125

147-
/// Create a demanded bits analysis pass.
148-
FunctionPass *createDemandedBitsWrapperPass();
149-
150126
} // end namespace llvm
151127

152128
#endif // LLVM_ANALYSIS_DEMANDEDBITS_H

llvm/include/llvm/InitializePasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void initializeDSELegacyPassPass(PassRegistry&);
102102
void initializeDeadMachineInstructionElimPass(PassRegistry&);
103103
void initializeDebugifyMachineModulePass(PassRegistry &);
104104
void initializeDelinearizationPass(PassRegistry&);
105-
void initializeDemandedBitsWrapperPassPass(PassRegistry&);
106105
void initializeDependenceAnalysisWrapperPassPass(PassRegistry&);
107106
void initializeDetectDeadLanesPass(PassRegistry&);
108107
void initializeDomOnlyPrinterWrapperPassPass(PassRegistry &);

llvm/lib/Analysis/Analysis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
3434
initializeCycleInfoWrapperPassPass(Registry);
3535
initializeDependenceAnalysisWrapperPassPass(Registry);
3636
initializeDelinearizationPass(Registry);
37-
initializeDemandedBitsWrapperPassPass(Registry);
3837
initializeDominanceFrontierWrapperPassPass(Registry);
3938
initializeDomViewerWrapperPassPass(Registry);
4039
initializeDomPrinterWrapperPassPass(Registry);

llvm/lib/Analysis/DemandedBits.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include "llvm/IR/PatternMatch.h"
3535
#include "llvm/IR/Type.h"
3636
#include "llvm/IR/Use.h"
37-
#include "llvm/InitializePasses.h"
38-
#include "llvm/Pass.h"
3937
#include "llvm/Support/Casting.h"
4038
#include "llvm/Support/Debug.h"
4139
#include "llvm/Support/KnownBits.h"
@@ -48,30 +46,6 @@ using namespace llvm::PatternMatch;
4846

4947
#define DEBUG_TYPE "demanded-bits"
5048

51-
char DemandedBitsWrapperPass::ID = 0;
52-
53-
INITIALIZE_PASS_BEGIN(DemandedBitsWrapperPass, "demanded-bits",
54-
"Demanded bits analysis", false, false)
55-
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
56-
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
57-
INITIALIZE_PASS_END(DemandedBitsWrapperPass, "demanded-bits",
58-
"Demanded bits analysis", false, false)
59-
60-
DemandedBitsWrapperPass::DemandedBitsWrapperPass() : FunctionPass(ID) {
61-
initializeDemandedBitsWrapperPassPass(*PassRegistry::getPassRegistry());
62-
}
63-
64-
void DemandedBitsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
65-
AU.setPreservesCFG();
66-
AU.addRequired<AssumptionCacheTracker>();
67-
AU.addRequired<DominatorTreeWrapperPass>();
68-
AU.setPreservesAll();
69-
}
70-
71-
void DemandedBitsWrapperPass::print(raw_ostream &OS, const Module *M) const {
72-
DB->print(OS);
73-
}
74-
7549
static bool isAlwaysLive(Instruction *I) {
7650
return I->isTerminator() || isa<DbgInfoIntrinsic>(I) || I->isEHPad() ||
7751
I->mayHaveSideEffects();
@@ -310,17 +284,6 @@ void DemandedBits::determineLiveOperandBits(
310284
}
311285
}
312286

313-
bool DemandedBitsWrapperPass::runOnFunction(Function &F) {
314-
auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
315-
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
316-
DB.emplace(F, AC, DT);
317-
return false;
318-
}
319-
320-
void DemandedBitsWrapperPass::releaseMemory() {
321-
DB.reset();
322-
}
323-
324287
void DemandedBits::performAnalysis() {
325288
if (Analyzed)
326289
// Analysis already completed for this function.
@@ -605,10 +568,6 @@ APInt DemandedBits::determineLiveOperandBitsSub(unsigned OperandNo,
605568
true);
606569
}
607570

608-
FunctionPass *llvm::createDemandedBitsWrapperPass() {
609-
return new DemandedBitsWrapperPass();
610-
}
611-
612571
AnalysisKey DemandedBitsAnalysis::Key;
613572

614573
DemandedBits DemandedBitsAnalysis::run(Function &F,

llvm/lib/CodeGen/ReplaceWithVeclib.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ void ReplaceWithVeclibLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
230230
AU.addPreserved<ScalarEvolutionWrapperPass>();
231231
AU.addPreserved<AAResultsWrapperPass>();
232232
AU.addPreserved<LoopAccessLegacyAnalysis>();
233-
AU.addPreserved<DemandedBitsWrapperPass>();
234233
AU.addPreserved<OptimizationRemarkEmitterWrapperPass>();
235234
AU.addPreserved<GlobalsAAWrapperPass>();
236235
}

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ void InjectTLIMappingsLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
159159
AU.addPreserved<ScalarEvolutionWrapperPass>();
160160
AU.addPreserved<AAResultsWrapperPass>();
161161
AU.addPreserved<LoopAccessLegacyAnalysis>();
162-
AU.addPreserved<DemandedBitsWrapperPass>();
163162
AU.addPreserved<OptimizationRemarkEmitterWrapperPass>();
164163
AU.addPreserved<GlobalsAAWrapperPass>();
165164
}

0 commit comments

Comments
 (0)