Minor bugfix to enable generation of methcall.llvm.lib, objinst.llvm.lib, and
authorChris Lattner <sabre@nondot.org>
Thu, 7 Nov 2002 04:59:28 +0000 (04:59 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 7 Nov 2002 04:59:28 +0000 (04:59 +0000)
The problem was merging two unsized types like function's, ie int (int*) with
int (uint *)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4594 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructure.cpp

index cb56db1f9f009f658e6e82ed2b0c83021c31e34f..18192a1c4ad422c5513d73f1bb462ae3628e416c 100644 (file)
@@ -187,7 +187,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) {
     return mergeTypeInfo(OldTy, 0);
   }
 
-  assert(Offset < Size &&
+  assert(Offset <= Size &&
          "Cannot merge something into a part of our type that doesn't exist!");
 
   // Find the section of Ty.Ty that NewTy overlaps with... first we find the
@@ -234,7 +234,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) {
   // structure, the type desired may actually be the first element of the
   // composite type...
   //
-  unsigned SubTypeSize = TD.getTypeSize(SubType);
+  unsigned SubTypeSize = SubType->isSized() ? TD.getTypeSize(SubType) : 0;
   while (SubType != NewTy) {
     const Type *NextSubType = 0;
     unsigned NextSubTypeSize;