diff --git a/lib/CodeGen/MachineOutliner.cpp b/lib/CodeGen/MachineOutliner.cpp index c4c3f2f568b..9c61bcee35c 100644 --- a/lib/CodeGen/MachineOutliner.cpp +++ b/lib/CodeGen/MachineOutliner.cpp @@ -904,10 +904,10 @@ struct MachineOutliner : public ModulePass { /// Return a DISubprogram for OF if one exists, and null otherwise. Helper /// function for remark emission. DISubprogram *getSubprogramOrNull(const OutlinedFunction &OF) { - DISubprogram *SP; for (const Candidate &C : OF.Candidates) - if (C.getMF() && (SP = C.getMF()->getFunction().getSubprogram())) - return SP; + if (MachineFunction *MF = C.getMF()) + if (DISubprogram *SP = MF->getFunction().getSubprogram()) + return SP; return nullptr; }