Skip to content

Commit

Permalink
Avoid by-value copies of referenced objects
Browse files Browse the repository at this point in the history
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
  • Loading branch information
urnathan committed Dec 16, 2021
1 parent 5fbe21a commit dd073e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
Expand Up @@ -301,7 +301,7 @@ bool DAGTypeLegalizer::run() {
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)) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Expand Up @@ -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';
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
Expand Up @@ -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());
}
Expand Down

0 comments on commit dd073e0

Please sign in to comment.