[llvm] cf56b08 - [IRSim] Adding missing comments canonical relation commit

Andrew Litteken via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 08:41:31 PDT 2021


Author: Andrew Litteken
Date: 2021-08-30T08:41:05-07:00
New Revision: cf56b08d15b6fe4c8b87569529e1d220baf44aea

URL: https://github.com/llvm/llvm-project/commit/cf56b08d15b6fe4c8b87569529e1d220baf44aea
DIFF: https://github.com/llvm/llvm-project/commit/cf56b08d15b6fe4c8b87569529e1d220baf44aea.diff

LOG: [IRSim] Adding missing comments canonical relation commit

Adding missing comments to IRSimilarityIdentifier.cpp since
they were not properly added in commit 063af63b9664151b3a9206feefa9a6a36a471e80.

Added: 
    

Modified: 
    llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index 99785a3ec53ef..033aa2184b811 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -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) {


        


More information about the llvm-commits mailing list