[PATCH] D94254: Fix gcc5 build failure (NFC)

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 12:00:49 PST 2021


mehdi_amini created this revision.
mehdi_amini added a reviewer: arsenm.
Herald added subscribers: kerbowa, hiraditya, nhaehnle, jvesely.
mehdi_amini requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94254

Files:
  llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
@@ -335,8 +335,8 @@
   // 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 &SplitArg = SplitArg[SplitIdx];
     Register Reg = OrigArg.Regs[SplitIdx];
     EVT VT = EVT::getEVT(SplitArg.Ty);
     LLT LLTy = getLLTForType(*SplitArg.Ty, DL);
@@ -348,8 +348,6 @@
       // 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;
       continue;
     }
 
@@ -367,8 +365,6 @@
     }
 
     PerformArgSplit(SplitRegs, Reg, LLTy, PartLLT, SplitIdx);
-
-    ++SplitIdx;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94254.315196.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210107/c5f4991f/attachment.bin>


More information about the llvm-commits mailing list