[llvm] dddfd77 - [GVN][NFC] Fix some variables as per coding standards (#129489)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 3 06:44:04 PST 2025


Author: Madhur Amilkanthwar
Date: 2025-03-03T20:14:01+05:30
New Revision: dddfd77f653d7e88965b647e9bc38827cae8bf8a

URL: https://github.com/llvm/llvm-project/commit/dddfd77f653d7e88965b647e9bc38827cae8bf8a
DIFF: https://github.com/llvm/llvm-project/commit/dddfd77f653d7e88965b647e9bc38827cae8bf8a.diff

LOG: [GVN][NFC] Fix some variables as per coding standards (#129489)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/GVN.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index c3aea6052c178..0b7044de73dd6 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) {


        


More information about the llvm-commits mailing list