Skip to content

[GVN][NFC] Fix some variables as per coding standards #129489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions llvm/lib/Transforms/Scalar/GVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
const MemoryDependenceResults::NonLocalDepInfo &deps =
MD->getNonLocalCallDependency(C);
// FIXME: Move the checking logic to MemDep!
CallInst* cdep = nullptr;
CallInst *CDep = nullptr;

// Check to see if we have a single dominating call instruction that is
// identical to C.
Expand All @@ -557,43 +557,43 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {

// We don't handle non-definitions. If we already have a call, reject
// instruction dependencies.
if (!I.getResult().isDef() || cdep != nullptr) {
cdep = nullptr;
if (!I.getResult().isDef() || CDep != nullptr) {
CDep = nullptr;
break;
}

CallInst *NonLocalDepCall = dyn_cast<CallInst>(I.getResult().getInst());
// FIXME: All duplicated with non-local case.
if (NonLocalDepCall && DT->properlyDominates(I.getBB(), C->getParent())) {
cdep = NonLocalDepCall;
CDep = NonLocalDepCall;
continue;
}

cdep = nullptr;
CDep = nullptr;
break;
}

if (!cdep) {
if (!CDep) {
valueNumbering[C] = nextValueNumber;
return nextValueNumber++;
}

if (cdep->arg_size() != C->arg_size()) {
if (CDep->arg_size() != C->arg_size()) {
valueNumbering[C] = nextValueNumber;
return nextValueNumber++;
}
for (unsigned i = 0, e = C->arg_size(); i < e; ++i) {
uint32_t c_vn = lookupOrAdd(C->getArgOperand(i));
uint32_t cd_vn = lookupOrAdd(cdep->getArgOperand(i));
if (c_vn != cd_vn) {
uint32_t CVN = lookupOrAdd(C->getArgOperand(i));
uint32_t CDepVN = lookupOrAdd(CDep->getArgOperand(i));
if (CVN != CDepVN) {
valueNumbering[C] = nextValueNumber;
return nextValueNumber++;
}
}

uint32_t v = lookupOrAdd(cdep);
valueNumbering[C] = v;
return v;
uint32_t V = lookupOrAdd(CDep);
valueNumbering[C] = V;
return V;
}

valueNumbering[C] = nextValueNumber;
Expand All @@ -618,7 +618,7 @@ uint32_t GVNPass::ValueTable::lookupOrAdd(Value *V) {
return nextValueNumber++;
}

Expression exp;
Expression Exp;
switch (I->getOpcode()) {
case Instruction::Call:
return lookupOrAddCall(cast<CallInst>(I));
Expand Down Expand Up @@ -662,13 +662,13 @@ uint32_t GVNPass::ValueTable::lookupOrAdd(Value *V) {
case Instruction::InsertElement:
case Instruction::ShuffleVector:
case Instruction::InsertValue:
exp = createExpr(I);
Exp = createExpr(I);
break;
case Instruction::GetElementPtr:
exp = createGEPExpr(cast<GetElementPtrInst>(I));
Exp = createGEPExpr(cast<GetElementPtrInst>(I));
break;
case Instruction::ExtractValue:
exp = createExtractvalueExpr(cast<ExtractValueInst>(I));
Exp = createExtractvalueExpr(cast<ExtractValueInst>(I));
break;
case Instruction::PHI:
valueNumbering[V] = nextValueNumber;
Expand All @@ -679,9 +679,9 @@ uint32_t GVNPass::ValueTable::lookupOrAdd(Value *V) {
return nextValueNumber++;
}

uint32_t e = assignExpNewValueNum(exp).first;
valueNumbering[V] = e;
return e;
uint32_t E = assignExpNewValueNum(Exp).first;
valueNumbering[V] = E;
return E;
}

/// Returns the value number of the specified value. Fails if
Expand Down Expand Up @@ -2317,15 +2317,15 @@ uint32_t GVNPass::ValueTable::phiTranslateImpl(const BasicBlock *Pred,
return Num;
Expression Exp = Expressions[ExprIdx[Num]];

for (unsigned i = 0; i < Exp.varargs.size(); i++) {
for (unsigned I = 0; I < Exp.varargs.size(); I++) {
// For InsertValue and ExtractValue, some varargs are index numbers
// instead of value numbers. Those index numbers should not be
// translated.
if ((i > 1 && Exp.opcode == Instruction::InsertValue) ||
(i > 0 && Exp.opcode == Instruction::ExtractValue) ||
(i > 1 && Exp.opcode == Instruction::ShuffleVector))
if ((I > 1 && Exp.opcode == Instruction::InsertValue) ||
(I > 0 && Exp.opcode == Instruction::ExtractValue) ||
(I > 1 && Exp.opcode == Instruction::ShuffleVector))
continue;
Exp.varargs[i] = phiTranslate(Pred, PhiBlock, Exp.varargs[i], Gvn);
Exp.varargs[I] = phiTranslate(Pred, PhiBlock, Exp.varargs[I], Gvn);
}

if (Exp.commutative) {
Expand Down
Loading