diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -1630,6 +1630,10 @@ unsigned IntersectSize = Join.size(); (void)IntersectSize; + // Check if A and B contain the same variables. + if (SymmetricDifference.empty() && A.size() == B.size()) + return Join; + // Add the elements in B with variables that are not in A into // SymmetricDifference. for (const auto &Pair : B) { @@ -1721,6 +1725,10 @@ unsigned IntersectSize = Join.size(); (void)IntersectSize; + // Check if A and B contain the same variables. + if (SymmetricDifference.empty() && A.size() == B.size()) + return Join; + // Add the elements in B with variables that are not in A into // SymmetricDifference. for (const auto &Pair : B) {