[llvm-commits] [poolalloc] r142584 - in /poolalloc/trunk/lib: DSA/DSGraph.cpp DSA/DSTest.cpp DSA/DataStructure.cpp DSA/TypeSafety.cpp PoolAllocate/PoolAllocate.cpp PoolAllocate/TransformFunctionBody.cpp

John Criswell criswell at uiuc.edu
Thu Oct 20 08:34:33 PDT 2011


Author: criswell
Date: Thu Oct 20 10:34:33 2011
New Revision: 142584

URL: http://llvm.org/viewvc/llvm-project?rev=142584&view=rev
Log:
Fix compilation when assertions are disabled.

Modified:
    poolalloc/trunk/lib/DSA/DSGraph.cpp
    poolalloc/trunk/lib/DSA/DSTest.cpp
    poolalloc/trunk/lib/DSA/DataStructure.cpp
    poolalloc/trunk/lib/DSA/TypeSafety.cpp
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Thu Oct 20 10:34:33 2011
@@ -1058,8 +1058,8 @@
         // to the node...
         for (DSNode::globals_iterator j = Node.globals_begin(), e = Node.globals_end();
              j != e; ++j) {
-          DSNode *N = getNodeForValue(*j).getNode();
-          assert(N == &Node && "ScalarMap doesn't match globals list!");
+          getNodeForValue(*j).getNode();
+          assert((getNodeForValue(*j).getNode()) == &Node && "ScalarMap doesn't match globals list!");
         }
 
         // Make sure NumReferrers still agrees, if so, the node is truly dead.

Modified: poolalloc/trunk/lib/DSA/DSTest.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSTest.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSTest.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSTest.cpp Thu Oct 20 10:34:33 2011
@@ -152,9 +152,8 @@
     // If we have more than 2 values left, then we have something like:
     // name1:name2:name3[:offset]*, which is no good.
     // Also, if we have *nothing* left, something is similarly wrong.
-    int stringsLeft = E - I;
-    assert((stringsLeft > 0) && "Node was entirely made of offsets?");
-    assert((stringsLeft <= 2) && "Too many colons! (Invalid node/offset given)");
+    assert(((E - I) > 0) && "Node was entirely made of offsets?");
+    assert(((E - I) <= 2) && "Too many colons! (Invalid node/offset given)");
 
     // Now rebuild the string, without the offsets.
     std::string rebuilt = I++->str();

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Thu Oct 20 10:34:33 2011
@@ -156,11 +156,10 @@
   //         "Node not OK!");
 
   assert(ParentGraph && "Node has no parent?");
-  const DSScalarMap &SM = ParentGraph->getScalarMap();
   for (globals_iterator ii = globals_begin(), ee = globals_end();
        ii != ee; ++ii) {
-    assert(SM.global_count(*ii));
-    assert(SM.find(*ii)->second.getNode() == this);
+    assert(ParentGraph->getScalarMap().global_count(*ii));
+    assert(ParentGraph->getScalarMap().find(*ii)->second.getNode() == this);
   }
 }
 
@@ -925,13 +924,17 @@
     DSNode *NewDN = new DSNode(*SN, Dest, true /* Null out all links */);
     NewDN->maskNodeTypes(BitsToKeep);
 
+#ifndef NDEBUG
     unsigned NHOffset = NH.getOffset();
+#endif
     NH.mergeWith(DSNodeHandle(NewDN, SrcNH.getOffset()));
 
+#ifndef NDEBUG
     assert(NH.getNode() &&
            (NH.getOffset() > NHOffset ||
             (NH.getOffset() == 0 && NH.getNode()->isNodeCompletelyFolded())) &&
            "Merging did not adjust the offset!");
+#endif
 
     // Before we start merging outgoing links and updating the scalar map, make
     // sure it is known that this is the representative node for the src node.

Modified: poolalloc/trunk/lib/DSA/TypeSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TypeSafety.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TypeSafety.cpp (original)
+++ poolalloc/trunk/lib/DSA/TypeSafety.cpp Thu Oct 20 10:34:33 2011
@@ -230,8 +230,7 @@
               while(ArrayType *AT1 = dyn_cast<ArrayType>(ElemTy))
                 ElemTy = AT1->getElementType();
               if(next_offset < (TD->getTypeStoreSize(ElemTy) + offset)) {
-                StructType *ST = dyn_cast<StructType>(ElemTy);
-                assert(ST && "Array Not of struct type ???? ");
+                assert(isa<StructType>(ElemTy) && "Array Not of Struct Type??");
                 overlaps = false;
               }
             }

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Thu Oct 20 10:34:33 2011
@@ -729,8 +729,10 @@
         for (unsigned index = 0; index < Functions.size(); ++index) {
           Function * F = const_cast<Function*>(Functions[index]);
           if (FunctionInfo.find (F) != FunctionInfo.end()) {
+#ifndef NDEBUG
             FuncInfo & FI =  FunctionInfo.find(F)->second;
             assert(FI.ArgNodes.size() == 0);
+#endif
             continue;
           }
           // TODO: Original code was:
@@ -859,8 +861,10 @@
   for (unsigned index = 0; index < Functions.size(); ++index) {
     Function * F = const_cast<Function*>(Functions[index]);
     if (FunctionInfo.find (F) != FunctionInfo.end()) {
+#ifndef NDEBUG
       FuncInfo & FI =  FunctionInfo.find(F)->second;
       assert(FI.ArgNodes.size() == MarkedNodes.size());
+#endif
       continue;
     }
 

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=142584&r1=142583&r2=142584&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Thu Oct 20 10:34:33 2011
@@ -177,6 +177,7 @@
 //
 void
 FuncTransform::verifyCallees (const std::vector<const Function *> & Functions) {
+#ifndef NDEBUG
   //
   // There's nothing to do if there's no function call targets at all.
   //
@@ -217,6 +218,7 @@
     assert (G == firstGraph);
     assert (FI->ArgNodes.size() == numPoolArgs);
   }
+#endif
 
   return;
 }
@@ -658,8 +660,7 @@
 void FuncTransform::visitStrdupCall(CallSite CS) {
   assert(CS.arg_end()-CS.arg_begin() == 1 && "strdup takes one argument!");
   Instruction *I = CS.getInstruction();
-  DSNode *Node = getDSNodeHFor(I).getNode();
-  assert (Node && "strdup has NULL DSNode!\n");
+  assert (getDSNodeHFor(I).getNode() && "strdup has NULL DSNode!\n");
   Value *PH = getPoolHandle(I);
 
   Type* Int8Type = Type::getInt8Ty(CS.getInstruction()->getContext());





More information about the llvm-commits mailing list