Skip to content

Commit

Permalink
[NFC][DwarfDebug] Prefer explicit to auto type deduction
Browse files Browse the repository at this point in the history
We should use explicit type instead of auto type deduction when
the type is so obvious. In addition, we remove ambiguity, since auto
type deduction sometimes is not that intuitive, so that could lead
us to some unwanted behavior.

This patch fixes that in the collectCallSiteParameters() from
DwarfDebug module.

Differential Revision: https://reviews.llvm.org/D79624
  • Loading branch information
djtodoro committed May 11, 2020
1 parent 8222107 commit 2552dc5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Expand Up @@ -652,9 +652,9 @@ static void collectCallSiteParameters(const MachineInstr *CallMI,
return;

auto *MBB = CallMI->getParent();
const auto &TRI = MF->getSubtarget().getRegisterInfo();
const auto &TII = MF->getSubtarget().getInstrInfo();
const auto &TLI = MF->getSubtarget().getTargetLowering();
const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo();
const TargetInstrInfo &TII = *MF->getSubtarget().getInstrInfo();
const TargetLowering &TLI = *MF->getSubtarget().getTargetLowering();

// Skip the call instruction.
auto I = std::next(CallMI->getReverseIterator());
Expand Down Expand Up @@ -715,7 +715,7 @@ static void collectCallSiteParameters(const MachineInstr *CallMI,
if (MO.isReg() && MO.isDef() &&
Register::isPhysicalRegister(MO.getReg())) {
for (auto FwdReg : ForwardedRegWorklist)
if (TRI->regsOverlap(FwdReg.first, MO.getReg()))
if (TRI.regsOverlap(FwdReg.first, MO.getReg()))
Defs.insert(FwdReg.first);
}
}
Expand Down Expand Up @@ -743,17 +743,17 @@ static void collectCallSiteParameters(const MachineInstr *CallMI,
continue;

for (auto ParamFwdReg : FwdRegDefs) {
if (auto ParamValue = TII->describeLoadedValue(*I, ParamFwdReg)) {
if (auto ParamValue = TII.describeLoadedValue(*I, ParamFwdReg)) {
if (ParamValue->first.isImm()) {
int64_t Val = ParamValue->first.getImm();
finishCallSiteParams(Val, ParamValue->second,
ForwardedRegWorklist[ParamFwdReg], Params);
} else if (ParamValue->first.isReg()) {
Register RegLoc = ParamValue->first.getReg();
unsigned SP = TLI->getStackPointerRegisterToSaveRestore();
Register FP = TRI->getFrameRegister(*MF);
unsigned SP = TLI.getStackPointerRegisterToSaveRestore();
Register FP = TRI.getFrameRegister(*MF);
bool IsSPorFP = (RegLoc == SP) || (RegLoc == FP);
if (TRI->isCalleeSavedPhysReg(RegLoc, *MF) || IsSPorFP) {
if (TRI.isCalleeSavedPhysReg(RegLoc, *MF) || IsSPorFP) {
MachineLocation MLoc(RegLoc, /*IsIndirect=*/IsSPorFP);
finishCallSiteParams(MLoc, ParamValue->second,
ForwardedRegWorklist[ParamFwdReg], Params);
Expand Down

0 comments on commit 2552dc5

Please sign in to comment.