[Target] Prevent copying in loop variables (NFC)
/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp:2769:19: error: loop variable '[Reg, N]' creates a copy from type 'std::pair<unsigned int, llvm::SDValue> const' [-Werror,-Wrange-loop-construct]
for (const auto [Reg, N] : RegsToPass) {
^
/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp:2769:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying
for (const auto [Reg, N] : RegsToPass) {
^~~~~~~~~~~~~~~~~~~~~
&
/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp:2954:19: error: loop variable '[Reg, N]' creates a copy from type 'std::pair<unsigned int, llvm::SDValue> const' [-Werror,-Wrange-loop-construct]
for (const auto [Reg, N] : RegsToPass)
^
/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp:2954:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying
for (const auto [Reg, N] : RegsToPass)
^~~~~~~~~~~~~~~~~~~~~
&
2 errors generated.
This commit is contained in:
@@ -1701,7 +1701,7 @@ void ARMFrameLowering::emitPushInst(MachineBasicBlock &MBB,
|
||||
.addReg(ARM::SP)
|
||||
.setMIFlags(MachineInstr::FrameSetup)
|
||||
.add(predOps(ARMCC::AL));
|
||||
for (const auto [Reg, Kill] : Regs)
|
||||
for (const auto &[Reg, Kill] : Regs)
|
||||
MIB.addReg(Reg, getKillRegState(Kill));
|
||||
} else if (Regs.size() == 1) {
|
||||
BuildMI(MBB, MI, DL, TII.get(StrOpc), ARM::SP)
|
||||
|
||||
@@ -2766,7 +2766,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
// Build a sequence of copy-to-reg nodes chained together with token chain
|
||||
// and flag operands which copy the outgoing args into the appropriate regs.
|
||||
SDValue InGlue;
|
||||
for (const auto [Reg, N] : RegsToPass) {
|
||||
for (const auto &[Reg, N] : RegsToPass) {
|
||||
Chain = DAG.getCopyToReg(Chain, dl, Reg, N, InGlue);
|
||||
InGlue = Chain.getValue(1);
|
||||
}
|
||||
@@ -2951,7 +2951,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
// Add argument registers to the end of the list so that they are known live
|
||||
// into the call.
|
||||
for (const auto [Reg, N] : RegsToPass)
|
||||
for (const auto &[Reg, N] : RegsToPass)
|
||||
Ops.push_back(DAG.getRegister(Reg, N.getValueType()));
|
||||
|
||||
// Add a register mask operand representing the call-preserved registers.
|
||||
|
||||
@@ -2421,7 +2421,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
// Build a sequence of copy-to-reg nodes chained together with token chain
|
||||
// and glue operands which copy the outgoing args into registers.
|
||||
SDValue InGlue;
|
||||
for (const auto [Reg, N] : RegsToPass) {
|
||||
for (const auto &[Reg, N] : RegsToPass) {
|
||||
Chain = DAG.getCopyToReg(Chain, dl, Reg, N, InGlue);
|
||||
InGlue = Chain.getValue(1);
|
||||
}
|
||||
@@ -2461,7 +2461,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
// Add argument registers to the end of the list so that they are known live
|
||||
// into the call.
|
||||
for (const auto [Reg, N] : RegsToPass)
|
||||
for (const auto &[Reg, N] : RegsToPass)
|
||||
Ops.push_back(DAG.getRegister(Reg, N.getValueType()));
|
||||
|
||||
// Add a register mask operand representing the call-preserved registers.
|
||||
|
||||
Reference in New Issue
Block a user