Skip to content

Commit c98f300

Browse files
committed
Update for review feedback.
1 parent 3f489e2 commit c98f300

File tree

2 files changed

+14
-14
lines changed
  • llvm
    • include/llvm/Transforms/Scalar
    • lib/Transforms/Scalar

2 files changed

+14
-14
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class GVNPass : public PassInfoMixin<GVNPass> {
249249

250250
public:
251251
class leader_iterator {
252-
const LeaderListNode *current;
252+
const LeaderListNode *Current;
253253

254254
public:
255255
using iterator_category = std::forward_iterator_tag;
@@ -258,19 +258,19 @@ class GVNPass : public PassInfoMixin<GVNPass> {
258258
using pointer = value_type *;
259259
using reference = value_type &;
260260

261-
leader_iterator(const LeaderListNode *ptr) : current(ptr) {}
261+
leader_iterator(const LeaderListNode *C) : Current(C) {}
262262
leader_iterator &operator++() {
263-
assert(current && "Dereferenced end of leader list!");
264-
current = current->Next;
263+
assert(Current && "Dereferenced end of leader list!");
264+
Current = Current->Next;
265265
return *this;
266266
}
267267
bool operator==(const leader_iterator &other) const {
268-
return current == other.current;
268+
return Current == other.Current;
269269
}
270270
bool operator!=(const leader_iterator &other) const {
271-
return current != other.current;
271+
return Current != other.Current;
272272
}
273-
reference operator*() const { return current->Entry; }
273+
reference operator*() const { return Current->Entry; }
274274
};
275275

276276
iterator_range<leader_iterator> getLeaders(uint32_t N) {
@@ -285,7 +285,7 @@ class GVNPass : public PassInfoMixin<GVNPass> {
285285
}
286286

287287
void insert(uint32_t N, Value *V, const BasicBlock *BB);
288-
void erase(uint32_t N, Instruction *I, BasicBlock *BB);
288+
void erase(uint32_t N, Instruction *I, const BasicBlock *BB);
289289
void verifyRemoved(const Value *Inst) const;
290290
void clear() {
291291
NumToLeaders.clear();

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,8 @@ void GVNPass::LeaderMap::insert(uint32_t N, Value *V, const BasicBlock *BB) {
747747

748748
/// Scan the list of values corresponding to a given
749749
/// value number, and remove the given instruction if encountered.
750-
void GVNPass::LeaderMap::erase(uint32_t N, Instruction *I, BasicBlock *BB) {
750+
void GVNPass::LeaderMap::erase(uint32_t N, Instruction *I,
751+
const BasicBlock *BB) {
751752
LeaderListNode *Prev = nullptr;
752753
LeaderListNode *Curr = &NumToLeaders[N];
753754

@@ -2267,9 +2268,8 @@ GVNPass::ValueTable::assignExpNewValueNum(Expression &Exp) {
22672268
bool GVNPass::ValueTable::areAllValsInBB(uint32_t Num, const BasicBlock *BB,
22682269
GVNPass &Gvn) {
22692270
auto I = Gvn.LeaderTable.getLeaders(Num);
2270-
return std::all_of(
2271-
I.begin(), I.end(),
2272-
[=](const LeaderMap::LeaderTableEntry &L) { return L.BB == BB; });
2271+
return all_of(
2272+
I, [=](const LeaderMap::LeaderTableEntry &L) { return L.BB == BB; });
22732273
}
22742274

22752275
/// Wrap phiTranslateImpl to provide caching functionality.
@@ -2292,7 +2292,7 @@ bool GVNPass::ValueTable::areCallValsEqual(uint32_t Num, uint32_t NewNum,
22922292
GVNPass &Gvn) {
22932293
CallInst *Call = nullptr;
22942294
auto Leaders = Gvn.LeaderTable.getLeaders(Num);
2295-
for (auto Entry : Leaders) {
2295+
for (const auto &Entry : Leaders) {
22962296
Call = dyn_cast<CallInst>(Entry.Val);
22972297
if (Call && Call->getParent() == PhiBlock)
22982298
break;
@@ -2393,7 +2393,7 @@ Value *GVNPass::findLeader(const BasicBlock *BB, uint32_t num) {
23932393
return nullptr;
23942394

23952395
Value *Val = nullptr;
2396-
for (auto Entry : Leaders) {
2396+
for (const auto &Entry : Leaders) {
23972397
if (DT->dominates(Entry.BB, BB)) {
23982398
Val = Entry.Val;
23992399
if (isa<Constant>(Val))

0 commit comments

Comments
 (0)