diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp --- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -423,7 +423,9 @@ SmallPtrSet VisitedBBs; SmallPtrSet Incoming; - for (auto *Pred : MI->getParent()->predecessors()) + MachineBasicBlock *Parent = MI->getParent(); + VisitedBBs.insert(Parent); + for (auto *Pred : Parent->predecessors()) getLiveOuts(Pred, PhysReg, Incoming, VisitedBBs); // If we have a local def and an incoming instruction, then there's not a