Skip to content

Commit c508e93

Browse files
committed
[InstSimplify] Remove unused ORE argument (NFC)
1 parent b9ba053 commit c508e93

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

llvm/include/llvm/Analysis/InstructionSimplify.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class Function;
5050
class Instruction;
5151
struct LoopStandardAnalysisResults;
5252
class MDNode;
53-
class OptimizationRemarkEmitter;
5453
class Pass;
5554
template <class T, unsigned n> class SmallSetVector;
5655
class TargetLibraryInfo;
@@ -325,15 +324,13 @@ Value *simplifyLoadInst(LoadInst *LI, Value *PtrOp, const SimplifyQuery &Q);
325324

326325
/// See if we can compute a simplified version of this instruction. If not,
327326
/// return null.
328-
Value *simplifyInstruction(Instruction *I, const SimplifyQuery &Q,
329-
OptimizationRemarkEmitter *ORE = nullptr);
327+
Value *simplifyInstruction(Instruction *I, const SimplifyQuery &Q);
330328

331329
/// Like \p simplifyInstruction but the operands of \p I are replaced with
332330
/// \p NewOps. Returns a simplified value, or null if none was found.
333331
Value *
334332
simplifyInstructionWithOperands(Instruction *I, ArrayRef<Value *> NewOps,
335-
const SimplifyQuery &Q,
336-
OptimizationRemarkEmitter *ORE = nullptr);
333+
const SimplifyQuery &Q);
337334

338335
/// See if V simplifies when its operand Op is replaced with RepOp. If not,
339336
/// return null.

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6681,8 +6681,7 @@ Value *llvm::simplifyLoadInst(LoadInst *LI, Value *PtrOp,
66816681

66826682
static Value *simplifyInstructionWithOperands(Instruction *I,
66836683
ArrayRef<Value *> NewOps,
6684-
const SimplifyQuery &SQ,
6685-
OptimizationRemarkEmitter *ORE) {
6684+
const SimplifyQuery &SQ) {
66866685
const SimplifyQuery Q = SQ.CxtI ? SQ : SQ.getWithInstruction(I);
66876686

66886687
switch (I->getOpcode()) {
@@ -6797,17 +6796,15 @@ static Value *simplifyInstructionWithOperands(Instruction *I,
67976796

67986797
Value *llvm::simplifyInstructionWithOperands(Instruction *I,
67996798
ArrayRef<Value *> NewOps,
6800-
const SimplifyQuery &SQ,
6801-
OptimizationRemarkEmitter *ORE) {
6799+
const SimplifyQuery &SQ) {
68026800
assert(NewOps.size() == I->getNumOperands() &&
68036801
"Number of operands should match the instruction!");
6804-
return ::simplifyInstructionWithOperands(I, NewOps, SQ, ORE);
6802+
return ::simplifyInstructionWithOperands(I, NewOps, SQ);
68056803
}
68066804

6807-
Value *llvm::simplifyInstruction(Instruction *I, const SimplifyQuery &SQ,
6808-
OptimizationRemarkEmitter *ORE) {
6805+
Value *llvm::simplifyInstruction(Instruction *I, const SimplifyQuery &SQ) {
68096806
SmallVector<Value *, 8> Ops(I->operands());
6810-
Value *Result = ::simplifyInstructionWithOperands(I, Ops, SQ, ORE);
6807+
Value *Result = ::simplifyInstructionWithOperands(I, Ops, SQ);
68116808

68126809
/// If called on unreachable code, the instruction may simplify to itself.
68136810
/// Make life easier for users by detecting that case here, and returning a

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11201,11 +11201,10 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
1120111201
InfoCache.getAnalysisResultForFunction<DominatorTreeAnalysis>(*F);
1120211202
const auto *TLI = A.getInfoCache().getTargetLibraryInfoForFunction(*F);
1120311203
auto *AC = InfoCache.getAnalysisResultForFunction<AssumptionAnalysis>(*F);
11204-
OptimizationRemarkEmitter *ORE = nullptr;
1120511204

1120611205
const DataLayout &DL = I.getModule()->getDataLayout();
1120711206
SimplifyQuery Q(DL, TLI, DT, AC, &I);
11208-
Value *NewV = simplifyInstructionWithOperands(&I, NewOps, Q, ORE);
11207+
Value *NewV = simplifyInstructionWithOperands(&I, NewOps, Q);
1120911208
if (!NewV || NewV == &I)
1121011209
return false;
1121111210

llvm/lib/Transforms/Scalar/InstSimplifyPass.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "llvm/ADT/Statistic.h"
1212
#include "llvm/Analysis/AssumptionCache.h"
1313
#include "llvm/Analysis/InstructionSimplify.h"
14-
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
1514
#include "llvm/Analysis/TargetLibraryInfo.h"
1615
#include "llvm/IR/Dominators.h"
1716
#include "llvm/IR/Function.h"
@@ -26,8 +25,7 @@ using namespace llvm;
2625

2726
STATISTIC(NumSimplified, "Number of redundant instructions removed");
2827

29-
static bool runImpl(Function &F, const SimplifyQuery &SQ,
30-
OptimizationRemarkEmitter *ORE) {
28+
static bool runImpl(Function &F, const SimplifyQuery &SQ) {
3129
SmallPtrSet<const Instruction *, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
3230
bool Changed = false;
3331

@@ -51,7 +49,7 @@ static bool runImpl(Function &F, const SimplifyQuery &SQ,
5149
DeadInstsInBB.push_back(&I);
5250
Changed = true;
5351
} else if (!I.use_empty()) {
54-
if (Value *V = simplifyInstruction(&I, SQ, ORE)) {
52+
if (Value *V = simplifyInstruction(&I, SQ)) {
5553
// Mark all uses for resimplification next time round the loop.
5654
for (User *U : I.users())
5755
Next->insert(cast<Instruction>(U));
@@ -88,7 +86,6 @@ struct InstSimplifyLegacyPass : public FunctionPass {
8886
AU.addRequired<DominatorTreeWrapperPass>();
8987
AU.addRequired<AssumptionCacheTracker>();
9088
AU.addRequired<TargetLibraryInfoWrapperPass>();
91-
AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
9289
}
9390

9491
/// Remove instructions that simplify.
@@ -102,11 +99,9 @@ struct InstSimplifyLegacyPass : public FunctionPass {
10299
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
103100
AssumptionCache *AC =
104101
&getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
105-
OptimizationRemarkEmitter *ORE =
106-
&getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE();
107102
const DataLayout &DL = F.getParent()->getDataLayout();
108103
const SimplifyQuery SQ(DL, TLI, DT, AC);
109-
return runImpl(F, SQ, ORE);
104+
return runImpl(F, SQ);
110105
}
111106
};
112107
} // namespace
@@ -117,7 +112,6 @@ INITIALIZE_PASS_BEGIN(InstSimplifyLegacyPass, "instsimplify",
117112
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
118113
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
119114
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
120-
INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass)
121115
INITIALIZE_PASS_END(InstSimplifyLegacyPass, "instsimplify",
122116
"Remove redundant instructions", false, false)
123117

@@ -131,10 +125,9 @@ PreservedAnalyses InstSimplifyPass::run(Function &F,
131125
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
132126
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
133127
auto &AC = AM.getResult<AssumptionAnalysis>(F);
134-
auto &ORE = AM.getResult<OptimizationRemarkEmitterAnalysis>(F);
135128
const DataLayout &DL = F.getParent()->getDataLayout();
136129
const SimplifyQuery SQ(DL, &TLI, &DT, &AC);
137-
bool Changed = runImpl(F, SQ, &ORE);
130+
bool Changed = runImpl(F, SQ);
138131
if (!Changed)
139132
return PreservedAnalyses::all();
140133

0 commit comments

Comments
 (0)