Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp =================================================================== --- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -1034,6 +1034,11 @@ return LiveLoc.size() == DebugValue.size() && LiveLoc.size() == StackHomeValue.size(); } + void clear() { + StackHomeValue.clear(); + DebugValue.clear(); + LiveLoc.clear(); + } }; Function &Fn; @@ -1082,7 +1087,8 @@ static Assignment joinAssignment(const Assignment &A, const Assignment &B); static AssignmentMap joinAssignmentMap(const AssignmentMap &A, const AssignmentMap &B); - static BlockInfo joinBlockInfo(const BlockInfo &A, const BlockInfo &B); + static void joinBlockInfo(BlockInfo &Result, const BlockInfo &A, + const BlockInfo &B); ///@} /// Process the instructions in \p BB updating \p LiveSet along the way. \p @@ -1746,15 +1752,14 @@ return Join; } -AssignmentTrackingLowering::BlockInfo -AssignmentTrackingLowering::joinBlockInfo(const BlockInfo &A, - const BlockInfo &B) { - BlockInfo Join; +void AssignmentTrackingLowering::joinBlockInfo(BlockInfo &Join, + const BlockInfo &A, + const BlockInfo &B) { + Join.clear(); Join.LiveLoc = joinLocMap(A.LiveLoc, B.LiveLoc); Join.StackHomeValue = joinAssignmentMap(A.StackHomeValue, B.StackHomeValue); Join.DebugValue = joinAssignmentMap(A.DebugValue, B.DebugValue); assert(Join.isValid()); - return Join; } bool AssignmentTrackingLowering::join( @@ -1800,7 +1805,8 @@ assert(VisitedPreds.size() > 1); const BlockInfo &PredLiveOut0 = LiveOut.find(VisitedPreds[0])->second; const BlockInfo &PredLiveOut1 = LiveOut.find(VisitedPreds[1])->second; - BlockInfo BBLiveIn = joinBlockInfo(PredLiveOut0, PredLiveOut1); + BlockInfo BBLiveIn; + joinBlockInfo(BBLiveIn, PredLiveOut0, PredLiveOut1); ArrayRef Tail = [&]() { auto *It = VisitedPreds.begin(); @@ -1813,7 +1819,7 @@ const auto &PredLiveOut = LiveOut.find(Pred); assert(PredLiveOut != LiveOut.end() && "block should have been processed already"); - BBLiveIn = joinBlockInfo(std::move(BBLiveIn), PredLiveOut->second); + joinBlockInfo(BBLiveIn, std::move(BBLiveIn), PredLiveOut->second); } // Save the joined result for BB.