Fix gcc5 build failure (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Thu, 7 Jan 2021 19:59:37 +0000 (19:59 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Thu, 7 Jan 2021 20:11:57 +0000 (20:11 +0000)
The loop index was shadowing the container name.
It seems that we can just not use a for-range loop here since there is
an induction variable anyway.

Differential Revision: https://reviews.llvm.org/D94254

llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp

index 12b9688..3b6e263 100644 (file)
@@ -330,11 +330,11 @@ void AMDGPUCallLowering::processSplitArgs(
   // FIXME: This is mostly nasty pre-processing before handleAssignments. Most
   // of this should be performed by handleAssignments.
 
-  int SplitIdx = 0;
-  for (const ArgInfo &SplitArg : SplitArg) {
+  for (int SplitIdx = 0, e = SplitArg.size(); SplitIdx != e; ++SplitIdx) {
+    const ArgInfo &CurSplitArg = SplitArg[SplitIdx];
     Register Reg = OrigArg.Regs[SplitIdx];
-    EVT VT = EVT::getEVT(SplitArg.Ty);
-    LLT LLTy = getLLTForType(*SplitArg.Ty, DL);
+    EVT VT = EVT::getEVT(CurSplitArg.Ty);
+    LLT LLTy = getLLTForType(*CurSplitArg.Ty, DL);
 
     unsigned NumParts = TLI.getNumRegistersForCallingConv(Ctx, CallConv, VT);
     MVT RegVT = TLI.getRegisterTypeForCallingConv(Ctx, CallConv, VT);
@@ -342,9 +342,8 @@ void AMDGPUCallLowering::processSplitArgs(
     if (NumParts == 1) {
       // No splitting to do, but we want to replace the original type (e.g. [1 x
       // double] -> double).
-      SplitArgs.emplace_back(Reg, SplitArg.Ty, OrigArg.Flags, OrigArg.IsFixed);
-
-      ++SplitIdx;
+      SplitArgs.emplace_back(Reg, CurSplitArg.Ty, OrigArg.Flags,
+                             OrigArg.IsFixed);
       continue;
     }
 
@@ -362,8 +361,6 @@ void AMDGPUCallLowering::processSplitArgs(
     }
 
     PerformArgSplit(SplitRegs, Reg, LLTy, PartLLT, SplitIdx);
-
-    ++SplitIdx;
   }
 }