Simplify code. We can compare TNew with T in one batch.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 1 Feb 2010 07:32:52 +0000 (07:32 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 1 Feb 2010 07:32:52 +0000 (07:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94973 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ImmutableSet.h

index ac06a4072b8fa14cc965099cac9af20ef0b5bde2..dcead4c5c79d1f3af10b95679a0216c638abd901 100644 (file)
@@ -581,25 +581,14 @@ public:
         continue;
       
       // We found a collision.  Perform a comparison of Contents('T')
-      // with Contents('L')+'V'+Contents('R').
+      // with Contents('TNew')
       typename TreeTy::iterator TI = T->begin(), TE = T->end();
       
-      // First compare Contents('L') with the (initial) contents of T.
-      if (!CompareTreeWithSection(TNew->getLeft(), TI, TE))
-        continue;
-      
-      // Now compare the new data element.
-      if (TI == TE || !TI->ElementEqual(TNew->getValue()))
-        continue;
-      
-      ++TI;
-      
-      // Now compare the remainder of 'T' with 'R'.
-      if (!CompareTreeWithSection(TNew->getRight(), TI, TE))
+      if (!CompareTreeWithSection(TNew, TI, TE))
         continue;
       
       if (TI != TE)
-        continue; // Contents('R') did not match suffix of 'T'.
+        continue; // T has more contents than TNew.
       
       // Trees did match!  Return 'T'.
       return T;