PPCReduceCRLogicals - fix static analyzer warnings. NFC

- Fix uninitialized variable warnings.
- Fix null dereference warnings.
This commit is contained in:
Simon Pilgrim 2019-11-13 13:46:43 +00:00
parent d1bd5e476b
commit 66f2ed0746
1 changed files with 6 additions and 6 deletions

View File

@ -375,10 +375,10 @@ public:
};
private:
const PPCInstrInfo *TII;
MachineFunction *MF;
MachineRegisterInfo *MRI;
const MachineBranchProbabilityInfo *MBPI;
const PPCInstrInfo *TII = nullptr;
MachineFunction *MF = nullptr;
MachineRegisterInfo *MRI = nullptr;
const MachineBranchProbabilityInfo *MBPI = nullptr;
// A vector to contain all the CR logical operations
SmallVector<CRLogicalOpInfo, 16> AllCRLogicalOps;
@ -470,21 +470,21 @@ PPCReduceCRLogicals::createCRLogicalOpInfo(MachineInstr &MIParam) {
} else {
MachineInstr *Def1 = lookThroughCRCopy(MIParam.getOperand(1).getReg(),
Ret.SubregDef1, Ret.CopyDefs.first);
assert(Def1 && "Must be able to find a definition of operand 1.");
Ret.DefsSingleUse &=
MRI->hasOneNonDBGUse(Def1->getOperand(0).getReg());
Ret.DefsSingleUse &=
MRI->hasOneNonDBGUse(Ret.CopyDefs.first->getOperand(0).getReg());
assert(Def1 && "Must be able to find a definition of operand 1.");
if (isBinary(MIParam)) {
Ret.IsBinary = 1;
MachineInstr *Def2 = lookThroughCRCopy(MIParam.getOperand(2).getReg(),
Ret.SubregDef2,
Ret.CopyDefs.second);
assert(Def2 && "Must be able to find a definition of operand 2.");
Ret.DefsSingleUse &=
MRI->hasOneNonDBGUse(Def2->getOperand(0).getReg());
Ret.DefsSingleUse &=
MRI->hasOneNonDBGUse(Ret.CopyDefs.second->getOperand(0).getReg());
assert(Def2 && "Must be able to find a definition of operand 2.");
Ret.TrueDefs = std::make_pair(Def1, Def2);
} else {
Ret.TrueDefs = std::make_pair(Def1, nullptr);