From 467e916d3032bc068995aa1b6b16655eb573e750 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 7 Jan 2021 19:59:37 +0000 Subject: [PATCH] Fix gcc5 build failure (NFC) 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 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp index 12b9688..3b6e263 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp @@ -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; } } -- 2.7.4