[IRSim] Adding missing comments canonical relation commit

Adding missing comments to IRSimilarityIdentifier.cpp since
they were not properly added in commit 063af63b96.
This commit is contained in:
Andrew Litteken 2021-08-30 08:34:25 -07:00
parent 5ea1c37118
commit cf56b08d15
1 changed files with 7 additions and 2 deletions

View File

@ -759,14 +759,19 @@ void IRSimilarityCandidate::createCanonicalRelationFrom(
assert(NumberToCanonNum.size() == 0 && "Canonical Relationship is non-empty");
DenseSet<unsigned> UsedGVNs;
// Iterate over the mappings provided from this candidate to A.
// Iterate over the mappings provided from this candidate to SourceCand. We
// are then able to map the GVN in this candidate to the same canonical number
// given to the corresponding GVN in SourceCand.
for (std::pair<unsigned, DenseSet<unsigned>> &GVNMapping : ToSourceMapping) {
unsigned SourceGVN = GVNMapping.first;
assert(GVNMapping.second.size() != 0 && "Possible GVNs is 0!");
unsigned ResultGVN;
// We need special handling if we have more than one potential value.
// We need special handling if we have more than one potential value. This
// means that there are at least two GVNs that could correspond to this GVN.
// This could lead to potential swapping later on, so we make a decision
// here to ensure a one-to-one mapping.
if (GVNMapping.second.size() > 1) {
bool Found = false;
for (unsigned Val : GVNMapping.second) {