Skip to content

Conversation

@madhur13490
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Mar 3, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Madhur Amilkanthwar (madhur13490)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/129489.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/GVN.cpp (+25-25)
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) {

@github-actions
Copy link

github-actions bot commented Mar 3, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@madhur13490 madhur13490 requested a review from nikic March 3, 2025 08:52
@madhur13490
Copy link
Contributor Author

This is fundamentally NFC. Can address comments if any post commit.

@madhur13490 madhur13490 merged commit dddfd77 into llvm:main Mar 3, 2025
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants