forked from OSchip/llvm-project
[X86] Reduce scope of variables where possible. NFCI.
Fixes cppcheck warnings. llvm-svn: 360131
This commit is contained in:
parent
d6d3808fa4
commit
3c975a0ab5
|
@ -3342,7 +3342,6 @@ bool X86InstrInfo::optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg,
|
|||
int CmpValue,
|
||||
const MachineRegisterInfo *MRI) const {
|
||||
// Check whether we can replace SUB with CMP.
|
||||
unsigned NewOpcode = 0;
|
||||
switch (CmpInstr.getOpcode()) {
|
||||
default: break;
|
||||
case X86::SUB64ri32:
|
||||
|
@ -3363,6 +3362,7 @@ bool X86InstrInfo::optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg,
|
|||
if (!MRI->use_nodbg_empty(CmpInstr.getOperand(0).getReg()))
|
||||
return false;
|
||||
// There is no use of the destination register, we can replace SUB with CMP.
|
||||
unsigned NewOpcode = 0;
|
||||
switch (CmpInstr.getOpcode()) {
|
||||
default: llvm_unreachable("Unreachable!");
|
||||
case X86::SUB64rm: NewOpcode = X86::CMP64rm; break;
|
||||
|
|
|
@ -112,14 +112,11 @@ bool PadShortFunc::runOnMachineFunction(MachineFunction &MF) {
|
|||
|
||||
bool MadeChange = false;
|
||||
|
||||
MachineBasicBlock *MBB;
|
||||
unsigned int Cycles = 0;
|
||||
|
||||
// Pad the identified basic blocks with NOOPs
|
||||
for (DenseMap<MachineBasicBlock*, unsigned int>::iterator I = ReturnBBs.begin();
|
||||
I != ReturnBBs.end(); ++I) {
|
||||
MBB = I->first;
|
||||
Cycles = I->second;
|
||||
MachineBasicBlock *MBB = I->first;
|
||||
unsigned Cycles = I->second;
|
||||
|
||||
if (Cycles < Threshold) {
|
||||
// BB ends in a return. Skip over any DBG_VALUE instructions
|
||||
|
|
|
@ -159,7 +159,7 @@ const RegisterBankInfo::InstructionMapping &
|
|||
X86RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
||||
const MachineFunction &MF = *MI.getParent()->getParent();
|
||||
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
auto Opc = MI.getOpcode();
|
||||
unsigned Opc = MI.getOpcode();
|
||||
|
||||
// Try the default logic for non-generic instructions that are either copies
|
||||
// or already have some operands assigned to banks.
|
||||
|
@ -182,9 +182,6 @@ X86RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
|||
case TargetOpcode::G_SHL:
|
||||
case TargetOpcode::G_LSHR:
|
||||
case TargetOpcode::G_ASHR: {
|
||||
const MachineFunction &MF = *MI.getParent()->getParent();
|
||||
const MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||
|
||||
unsigned NumOperands = MI.getNumOperands();
|
||||
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
|
||||
|
||||
|
|
Loading…
Reference in New Issue