diff --git a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp index 3b71ed219c17c..9a4c7c219d7ca 100644 --- a/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp +++ b/llvm/lib/Target/PowerPC/PPCReduceCRLogicals.cpp @@ -375,10 +375,10 @@ class PPCReduceCRLogicals : public MachineFunctionPass { }; 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 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);