[llvm-commits] [poolalloc] r47332 - /poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

John Criswell criswell at uiuc.edu
Tue Feb 19 10:42:45 PST 2008


Author: criswell
Date: Tue Feb 19 12:42:43 2008
New Revision: 47332

URL: http://llvm.org/viewvc/llvm-project?rev=47332&view=rev
Log:
Only adjust function attributes when the original function has attributes.

Modified:
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=47332&r1=47331&r2=47332&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Tue Feb 19 12:42:43 2008
@@ -432,22 +432,24 @@
   // that the pool descriptor has no attributes.
   //
   const ParamAttrsList * OldAttrs = New->getParamAttrs();
-  ParamAttrsVector NewAttrsVector;
-  for (unsigned index = 0; index < OldAttrs->size(); ++index) {
-    // Find the argument index
-    unsigned argIndex = OldAttrs->getParamIndex (index);
+  if (OldAttrs) {
+    ParamAttrsVector NewAttrsVector;
+    for (unsigned index = 0; index < OldAttrs->size(); ++index) {
+      // Find the argument index
+      unsigned argIndex = OldAttrs->getParamIndex (index);
+
+      // If it's not the return value, move the attribute to the next
+      // parameter.
+      if (argIndex) ++argIndex;
 
-    // If it's not the return value, move the attribute to the next
-    // parameter.
-    if (argIndex) ++argIndex;
+      // Add the parameter to the new list.
+      NewAttrsVector.push_back(ParamAttrsWithIndex::get(argIndex,OldAttrs->getParamAttrsAtIndex(index)));
+    }
 
-    // Add the parameter to the new list.
-    NewAttrsVector.push_back(ParamAttrsWithIndex::get(argIndex,OldAttrs->getParamAttrsAtIndex(index)));
+    // Assign the new attributes to the function clone
+    New->setParamAttrs (ParamAttrsList::get (NewAttrsVector));
   }
 
-  // Assign the new attributes to the function clone
-  New->setParamAttrs (ParamAttrsList::get (NewAttrsVector));
-
   // Invert the ValueMap into the NewToOldValueMap
   std::map<Value*, const Value*> &NewToOldValueMap = FI.NewToOldValueMap;
 





More information about the llvm-commits mailing list