Avoid by-value copies of referenced objects

These were detected by the new -Wauto-by-value-copy (D114989) warning, these by-value
constant copies need only be references.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D114990
This commit is contained in:
Nathan Sidwell 2021-10-12 09:28:20 -07:00
parent 5fbe21a774
commit dd073e08ae
3 changed files with 4 additions and 4 deletions

View File

@ -301,7 +301,7 @@ ScanOperands:
if (IgnoreNodeResults(N->getOperand(i).getNode()))
continue;
const auto Op = N->getOperand(i);
const auto &Op = N->getOperand(i);
LLVM_DEBUG(dbgs() << "Analyzing operand: "; Op.dump(&DAG));
EVT OpVT = Op.getValueType();
switch (getTypeAction(OpVT)) {

View File

@ -531,7 +531,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath) {
<< LR->Locations.size() << "\n";
Log << " " << NumDwarfInlineInfos << " DWARF frames:\n";
for (size_t Idx = 0; Idx < NumDwarfInlineInfos; ++Idx) {
const auto dii = DwarfInlineInfos.getFrame(Idx);
const auto &dii = DwarfInlineInfos.getFrame(Idx);
Log << " [" << Idx << "]: " << dii.FunctionName << " @ "
<< dii.FileName << ':' << dii.Line << '\n';
}
@ -551,7 +551,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath) {
++Idx) {
const auto &gii = LR->Locations[Idx];
if (Idx < NumDwarfInlineInfos) {
const auto dii = DwarfInlineInfos.getFrame(Idx);
const auto &dii = DwarfInlineInfos.getFrame(Idx);
gsymFilename = LR->getSourceFile(Idx);
// Verify function name
if (dii.FunctionName.find(gii.Name.str()) != 0)

View File

@ -349,7 +349,7 @@ uint64_t FileAnalysis::indirectCFOperandClobber(const GraphResult &Graph) const
// Add the registers this load reads to those we check for clobbers.
for (unsigned i = InstrDesc.getNumDefs(),
e = InstrDesc.getNumOperands(); i != e; i++) {
const auto Operand = NodeInstr.Instruction.getOperand(i);
const auto &Operand = NodeInstr.Instruction.getOperand(i);
if (Operand.isReg())
CurRegisterNumbers.insert(Operand.getReg());
}