[llvm] 0729ae3 - X86DomainReassignment.cpp - improve auto const/pointer/reference qualifiers. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 05:01:41 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-08T13:01:23+01:00
New Revision: 0729ae367af07c2c75d08cfa881795b325fcf922
URL: https://github.com/llvm/llvm-project/commit/0729ae367af07c2c75d08cfa881795b325fcf922
DIFF: https://github.com/llvm/llvm-project/commit/0729ae367af07c2c75d08cfa881795b325fcf922.diff
LOG: X86DomainReassignment.cpp - improve auto const/pointer/reference qualifiers. NFCI.
Fix clang-tidy warnings by ensuring auto variables are more cleanly qualified, or just avoid auto entirely.
Added:
Modified:
llvm/lib/Target/X86/X86DomainReassignment.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86DomainReassignment.cpp b/llvm/lib/Target/X86/X86DomainReassignment.cpp
index 488ee51f1d89..3a0d6a52ef46 100644
--- a/llvm/lib/Target/X86/X86DomainReassignment.cpp
+++ b/llvm/lib/Target/X86/X86DomainReassignment.cpp
@@ -141,7 +141,7 @@ class InstrReplacer : public InstrConverterBase {
return false;
// It's illegal to replace an instruction that implicitly defines a register
// with an instruction that doesn't, unless that register dead.
- for (auto &MO : MI->implicit_operands())
+ for (const auto &MO : MI->implicit_operands())
if (MO.isReg() && MO.isDef() && !MO.isDead() &&
!TII->get(DstOpcode).hasImplicitDefOfPhysReg(MO.getReg()))
return false;
@@ -180,7 +180,7 @@ class InstrReplacerDstCOPY : public InstrConverterBase {
MachineRegisterInfo *MRI) const override {
assert(isLegal(MI, TII) && "Cannot convert instruction");
MachineBasicBlock *MBB = MI->getParent();
- auto &DL = MI->getDebugLoc();
+ const DebugLoc &DL = MI->getDebugLoc();
Register Reg = MRI->createVirtualRegister(
TII->getRegClass(TII->get(DstOpcode), 0, MRI->getTargetRegisterInfo(),
@@ -237,7 +237,7 @@ class InstrCOPYReplacer : public InstrReplacer {
MachineRegisterInfo *MRI) const override {
assert(MI->getOpcode() == TargetOpcode::COPY && "Expected a COPY");
- for (auto &MO : MI->operands()) {
+ for (const auto &MO : MI->operands()) {
// Physical registers will not be converted. Assume that converting the
// COPY to the destination domain will eventually result in a actual
// instruction.
@@ -517,7 +517,7 @@ void X86DomainReassignment::reassign(const Closure &C, RegDomain Domain) const {
}
}
- for (auto MI : ToErase)
+ for (auto *MI : ToErase)
MI->eraseFromParent();
}
@@ -537,7 +537,7 @@ static bool usedAsAddr(const MachineInstr &MI, unsigned Reg,
for (unsigned MemOpIdx = MemOpStart,
MemOpEnd = MemOpStart + X86::AddrNumOperands;
MemOpIdx < MemOpEnd; ++MemOpIdx) {
- auto &Op = MI.getOperand(MemOpIdx);
+ const MachineOperand &Op = MI.getOperand(MemOpIdx);
if (Op.isReg() && Op.getReg() == Reg)
return true;
}
More information about the llvm-commits
mailing list