diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp index b1f742b838f2a..89a2a7ac9be3f 100644 --- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp +++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp @@ -852,10 +852,11 @@ void StructurizeCFG::setPhiValues() { BasicBlock *To = AddedPhi.first; const BBVector &From = AddedPhi.second; - if (!DeletedPhis.count(To)) + auto It = DeletedPhis.find(To); + if (It == DeletedPhis.end()) continue; - PhiMap &Map = DeletedPhis[To]; + PhiMap &Map = It->second; SmallVector &UndefBlks = UndefBlksMap[To]; for (const auto &[Phi, Incoming] : Map) { Value *Undef = UndefValue::get(Phi->getType());