Skip to content

Commit 66f2ed0

Browse files
committed
PPCReduceCRLogicals - fix static analyzer warnings. NFC
- Fix uninitialized variable warnings. - Fix null dereference warnings.
1 parent d1bd5e4 commit 66f2ed0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@ class PPCReduceCRLogicals : public MachineFunctionPass {
375375
};
376376

377377
private:
378-
const PPCInstrInfo *TII;
379-
MachineFunction *MF;
380-
MachineRegisterInfo *MRI;
381-
const MachineBranchProbabilityInfo *MBPI;
378+
const PPCInstrInfo *TII = nullptr;
379+
MachineFunction *MF = nullptr;
380+
MachineRegisterInfo *MRI = nullptr;
381+
const MachineBranchProbabilityInfo *MBPI = nullptr;
382382

383383
// A vector to contain all the CR logical operations
384384
SmallVector<CRLogicalOpInfo, 16> AllCRLogicalOps;
@@ -470,21 +470,21 @@ PPCReduceCRLogicals::createCRLogicalOpInfo(MachineInstr &MIParam) {
470470
} else {
471471
MachineInstr *Def1 = lookThroughCRCopy(MIParam.getOperand(1).getReg(),
472472
Ret.SubregDef1, Ret.CopyDefs.first);
473+
assert(Def1 && "Must be able to find a definition of operand 1.");
473474
Ret.DefsSingleUse &=
474475
MRI->hasOneNonDBGUse(Def1->getOperand(0).getReg());
475476
Ret.DefsSingleUse &=
476477
MRI->hasOneNonDBGUse(Ret.CopyDefs.first->getOperand(0).getReg());
477-
assert(Def1 && "Must be able to find a definition of operand 1.");
478478
if (isBinary(MIParam)) {
479479
Ret.IsBinary = 1;
480480
MachineInstr *Def2 = lookThroughCRCopy(MIParam.getOperand(2).getReg(),
481481
Ret.SubregDef2,
482482
Ret.CopyDefs.second);
483+
assert(Def2 && "Must be able to find a definition of operand 2.");
483484
Ret.DefsSingleUse &=
484485
MRI->hasOneNonDBGUse(Def2->getOperand(0).getReg());
485486
Ret.DefsSingleUse &=
486487
MRI->hasOneNonDBGUse(Ret.CopyDefs.second->getOperand(0).getReg());
487-
assert(Def2 && "Must be able to find a definition of operand 2.");
488488
Ret.TrueDefs = std::make_pair(Def1, Def2);
489489
} else {
490490
Ret.TrueDefs = std::make_pair(Def1, nullptr);

0 commit comments

Comments
 (0)