[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 16 10:10:53 PST 2005



Changes in directory llvm-poolalloc/lib/PoolAllocate:

PoolAllocate.h updated: 1.42 -> 1.43
---
Log message:

Handle values that have no correspondence in the original function.


---
Diffs of the changes:  (+4 -3)

 PoolAllocate.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h
diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.42 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.43
--- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h:1.42	Wed Feb 16 11:38:03 2005
+++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.h	Wed Feb 16 12:10:40 2005
@@ -80,11 +80,12 @@
     std::map<Value*, const Value*> NewToOldValueMap;
 
     /// MapValueToOriginal - Given a value in the cloned version of this
-    /// function, map it back to the original.
+    /// function, map it back to the original.  If the specified value did not
+    /// exist in the original function (e.g. because it's a pool descriptor),
+    /// return null.
     Value *MapValueToOriginal(Value *V) const {
       std::map<Value*,const Value*>::const_iterator I =NewToOldValueMap.find(V);
-      assert(I != NewToOldValueMap.end() && "This is not a cloned value!");
-      return const_cast<Value*>(I->second);
+      return I != NewToOldValueMap.end() ? const_cast<Value*>(I->second) : 0;
     }
   };
 






More information about the llvm-commits mailing list