[llvm] 9da119a - [X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 07:49:43 PDT 2023


Author: Simon Pilgrim
Date: 2023-07-23T15:49:33+01:00
New Revision: 9da119a6a6d73929bbdb2de3b1a17c4e661b9b36

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

LOG: [X86] getIntImmCostInst - avoid repeating getNumOperands() in for-loop (style). NFC.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 201273a7ca40f4..17981b3b9374a2 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -5671,15 +5671,15 @@ InstructionCost X86TTIImpl::getGSVectorCost(unsigned Opcode, Type *SrcVTy,
     const Value *Ptrs = GEP->getPointerOperand();
     if (Ptrs->getType()->isVectorTy() && !getSplatValue(Ptrs))
       return IndexSize;
-    for (unsigned i = 1; i < GEP->getNumOperands(); ++i) {
-      if (isa<Constant>(GEP->getOperand(i)))
+    for (unsigned I = 1, E = GEP->getNumOperands(); I != E; ++I) {
+      if (isa<Constant>(GEP->getOperand(I)))
         continue;
-      Type *IndxTy = GEP->getOperand(i)->getType();
+      Type *IndxTy = GEP->getOperand(I)->getType();
       if (auto *IndexVTy = dyn_cast<VectorType>(IndxTy))
         IndxTy = IndexVTy->getElementType();
       if ((IndxTy->getPrimitiveSizeInBits() == 64 &&
-          !isa<SExtInst>(GEP->getOperand(i))) ||
-         ++NumOfVarIndices > 1)
+           !isa<SExtInst>(GEP->getOperand(I))) ||
+          ++NumOfVarIndices > 1)
         return IndexSize; // 64
     }
     return (unsigned)32;


        


More information about the llvm-commits mailing list