Skip to content

Commit 25d52fb

Browse files
committed
[PowerPC] Prevent copying in loop variables (NFC)
/data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:5769: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) ^ /data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:5769:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying for (const auto [Reg, N] : RegsToPass) ^~~~~~~~~~~~~~~~~~~~~ & /data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:6193: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) { ^ /data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:6193:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying for (const auto [Reg, N] : RegsToPass) { ^~~~~~~~~~~~~~~~~~~~~ & /data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:6806: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) { ^ /data/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:6806:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying for (const auto [Reg, N] : RegsToPass) { ^~~~~~~~~~~~~~~~~~~~~ & 3 errors generated.
1 parent 6c2aa37 commit 25d52fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5766,7 +5766,7 @@ buildCallOperands(SmallVectorImpl<SDValue> &Ops,
57665766

57675767
// Add argument registers to the end of the list so that they are known live
57685768
// into the call.
5769-
for (const auto [Reg, N] : RegsToPass)
5769+
for (const auto &[Reg, N] : RegsToPass)
57705770
Ops.push_back(DAG.getRegister(Reg, N.getValueType()));
57715771

57725772
// We cannot add R2/X2 as an operand here for PATCHPOINT, because there is
@@ -6190,7 +6190,7 @@ SDValue PPCTargetLowering::LowerCall_32SVR4(
61906190
// Build a sequence of copy-to-reg nodes chained together with token chain
61916191
// and flag operands which copy the outgoing args into the appropriate regs.
61926192
SDValue InGlue;
6193-
for (const auto [Reg, N] : RegsToPass) {
6193+
for (const auto &[Reg, N] : RegsToPass) {
61946194
Chain = DAG.getCopyToReg(Chain, dl, Reg, N, InGlue);
61956195
InGlue = Chain.getValue(1);
61966196
}
@@ -6803,7 +6803,7 @@ SDValue PPCTargetLowering::LowerCall_64SVR4(
68036803
// Build a sequence of copy-to-reg nodes chained together with token chain
68046804
// and flag operands which copy the outgoing args into the appropriate regs.
68056805
SDValue InGlue;
6806-
for (const auto [Reg, N] : RegsToPass) {
6806+
for (const auto &[Reg, N] : RegsToPass) {
68076807
Chain = DAG.getCopyToReg(Chain, dl, Reg, N, InGlue);
68086808
InGlue = Chain.getValue(1);
68096809
}

0 commit comments

Comments
 (0)