Skip to content

Commit 460d628

Browse files
[GVN] Clean up unused argument, unify style, modernize syntax (NFC)
Finalize code style overhaul in GVN, following up to 2a0946b and 9deed7d.
1 parent 0ae9c65 commit 460d628

File tree

2 files changed

+247
-250
lines changed
  • llvm
    • include/llvm/Transforms/Scalar
    • lib/Transforms/Scalar

2 files changed

+247
-250
lines changed

llvm/include/llvm/Transforms/Scalar/GVN.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ class GVNPass : public PassInfoMixin<GVNPass> {
157157
/// as an efficient mechanism to determine the expression-wise equivalence of
158158
/// two values.
159159
class ValueTable {
160-
DenseMap<Value *, uint32_t> valueNumbering;
161-
DenseMap<Expression, uint32_t> expressionNumbering;
160+
DenseMap<Value *, uint32_t> ValueNumbering;
161+
DenseMap<Expression, uint32_t> ExpressionNumbering;
162162

163163
// Expressions is the vector of Expression. ExprIdx is the mapping from
164164
// value number to the index of Expression in Expressions. We use it
165165
// instead of a DenseMap because filling such mapping is faster than
166166
// filling a DenseMap and the compile time is a little better.
167-
uint32_t nextExprNumber = 0;
167+
uint32_t NextExprNumber = 0;
168168

169169
std::vector<Expression> Expressions;
170170
std::vector<uint32_t> ExprIdx;
@@ -181,7 +181,7 @@ class GVNPass : public PassInfoMixin<GVNPass> {
181181
MemoryDependenceResults *MD = nullptr;
182182
DominatorTree *DT = nullptr;
183183

184-
uint32_t nextValueNumber = 1;
184+
uint32_t NextValueNumber = 1;
185185

186186
Expression createExpr(Instruction *I);
187187
Expression createCmpExpr(unsigned Opcode, CmpInst::Predicate Predicate,
@@ -190,11 +190,11 @@ class GVNPass : public PassInfoMixin<GVNPass> {
190190
Expression createGEPExpr(GetElementPtrInst *GEP);
191191
uint32_t lookupOrAddCall(CallInst *C);
192192
uint32_t phiTranslateImpl(const BasicBlock *BB, const BasicBlock *PhiBlock,
193-
uint32_t Num, GVNPass &Gvn);
193+
uint32_t Num, GVNPass &GVN);
194194
bool areCallValsEqual(uint32_t Num, uint32_t NewNum, const BasicBlock *Pred,
195-
const BasicBlock *PhiBlock, GVNPass &Gvn);
196-
std::pair<uint32_t, bool> assignExpNewValueNum(Expression &exp);
197-
bool areAllValsInBB(uint32_t num, const BasicBlock *BB, GVNPass &Gvn);
195+
const BasicBlock *PhiBlock, GVNPass &GVN);
196+
std::pair<uint32_t, bool> assignExpNewValueNum(Expression &Exp);
197+
bool areAllValsInBB(uint32_t Num, const BasicBlock *BB, GVNPass &GVN);
198198

199199
public:
200200
ValueTable();
@@ -208,17 +208,17 @@ class GVNPass : public PassInfoMixin<GVNPass> {
208208
uint32_t lookupOrAddCmp(unsigned Opcode, CmpInst::Predicate Pred,
209209
Value *LHS, Value *RHS);
210210
uint32_t phiTranslate(const BasicBlock *BB, const BasicBlock *PhiBlock,
211-
uint32_t Num, GVNPass &Gvn);
211+
uint32_t Num, GVNPass &GVN);
212212
void eraseTranslateCacheEntry(uint32_t Num, const BasicBlock &CurrBlock);
213213
bool exists(Value *V) const;
214-
void add(Value *V, uint32_t num);
214+
void add(Value *V, uint32_t Num);
215215
void clear();
216-
void erase(Value *v);
216+
void erase(Value *V);
217217
void setAliasAnalysis(AAResults *A) { AA = A; }
218218
AAResults *getAliasAnalysis() const { return AA; }
219219
void setMemDep(MemoryDependenceResults *M) { MD = M; }
220220
void setDomTree(DominatorTree *D) { DT = D; }
221-
uint32_t getNextUnusedValueNumber() { return nextValueNumber; }
221+
uint32_t getNextUnusedValueNumber() { return NextValueNumber; }
222222
void verifyRemoved(const Value *) const;
223223
};
224224

@@ -327,9 +327,9 @@ class GVNPass : public PassInfoMixin<GVNPass> {
327327
OptimizationRemarkEmitter *ORE, MemorySSA *MSSA = nullptr);
328328

329329
// List of critical edges to be split between iterations.
330-
SmallVector<std::pair<Instruction *, unsigned>, 4> toSplit;
330+
SmallVector<std::pair<Instruction *, unsigned>, 4> ToSplit;
331331

332-
// Helper functions of redundant load elimination
332+
// Helper functions of redundant load elimination.
333333
bool processLoad(LoadInst *L);
334334
bool processNonLocalLoad(LoadInst *L);
335335
bool processAssumeIntrinsic(AssumeInst *II);
@@ -367,16 +367,16 @@ class GVNPass : public PassInfoMixin<GVNPass> {
367367
MapVector<BasicBlock *, Value *> &AvailableLoads,
368368
MapVector<BasicBlock *, LoadInst *> *CriticalEdgePredAndLoad);
369369

370-
// Other helper routines
370+
// Other helper routines.
371371
bool processInstruction(Instruction *I);
372372
bool processBlock(BasicBlock *BB);
373-
void dump(DenseMap<uint32_t, Value *> &d) const;
373+
void dump(DenseMap<uint32_t, Value *> &Map) const;
374374
bool iterateOnFunction(Function &F);
375375
bool performPRE(Function &F);
376376
bool performScalarPRE(Instruction *I);
377377
bool performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
378378
BasicBlock *Curr, unsigned int ValNo);
379-
Value *findLeader(const BasicBlock *BB, uint32_t num);
379+
Value *findLeader(const BasicBlock *BB, uint32_t Num);
380380
void cleanupGlobalSets();
381381
void removeInstruction(Instruction *I);
382382
void verifyRemoved(const Instruction *I) const;

0 commit comments

Comments
 (0)