Where the new checks have been added, SymmetricDifference - still being built - contains entries for variables present in A and not in B.
If SymmetricDifference is empty at this point it means the variables (map keys) in A are a subset of those in B, so if A and B are the same size then we know they're identical.
This reduces the number of instructions retired building some of the CTMark projects in a ReleaseLTO-g configuration (geomean change -0.05% with the best improvement being -0.24% for tramp3d-v4)
I think this (and the check below) could be alternatively implemented as if (SymmetricDifference.empty() && A.size() == B.size()) return Join;, since the only thing left in the function outside of this block is the asserts which look to trivially always hold if this block isn't executed - but just a suggestion, if you disagree then no issues merging.