[llvm] r247221 - [RewriteStatepointsForGC] Strengthen a confusingly weak assertion [NFC]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 17:32:56 PDT 2015


Author: reames
Date: Wed Sep  9 19:32:56 2015
New Revision: 247221

URL: http://llvm.org/viewvc/llvm-project?rev=247221&view=rev
Log:
[RewriteStatepointsForGC] Strengthen a confusingly weak assertion [NFC]

The assertion was weaker than it should be and gave the impression we're growing the number of base defining values being considered during the fixed point interation.  That's not true.  The tighter form of the assert is useful documentation.


Modified:
    llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=247221&r1=247220&r2=247221&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Wed Sep  9 19:32:56 2015
@@ -797,7 +797,7 @@ static Value *findBasePointer(Value *I,
   bool progress = true;
   while (progress) {
 #ifndef NDEBUG
-    size_t oldSize = States.size();
+    const size_t oldSize = States.size();
 #endif
     progress = false;
     // We're only changing values in this loop, thus safe to keep iterators.
@@ -842,8 +842,8 @@ static Value *findBasePointer(Value *I,
       }
     }
 
-    assert(oldSize <= States.size());
-    assert(oldSize == States.size() || progress);
+    assert(oldSize == States.size() &&
+           "fixed point shouldn't be adding any new nodes to state");
   }
 
 #ifndef NDEBUG




More information about the llvm-commits mailing list