[MachineOutliner] Reduce scope of variable and stop duplicate getMF() calls. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 5 Nov 2019 15:58:04 +0000 (15:58 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 5 Nov 2019 17:08:08 +0000 (17:08 +0000)
llvm/lib/CodeGen/MachineOutliner.cpp

index c4c3f2f..9c61bce 100644 (file)
@@ -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;
   }