-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-llvm-transforms Author: Madhur Amilkanthwar (madhur13490) ChangesFull diff: https://github.com/llvm/llvm-project/pull/129489.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index c3aea6052c178..b294332e71827 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -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.
@@ -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;
@@ -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));
@@ -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;
@@ -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
@@ -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) {
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
1fd3bde
to
a6edad3
Compare
This is fundamentally NFC. Can address comments if any post commit. |
jph-13
pushed a commit
to jph-13/llvm-project
that referenced
this pull request
Mar 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.