aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-02 21:02:20 +0000
committerChris Lattner <sabre@nondot.org>2003-11-02 21:02:20 +0000
commitdbfe36e51eff9324ad5abf7af9a852de07f04ef9 (patch)
tree312913fb72bf048d8f65fd8f005d0fc70771949a /lib/Analysis/DataStructure/DataStructure.cpp
parentdab02aeada53242748240e78eed17197a7e50b36 (diff)
Fix bug: test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index b125b5d67f..efcae9826e 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -252,9 +252,11 @@ namespace {
/// ElementTypesAreCompatible - Check to see if the specified types are
/// "physically" compatible. If so, return true, else return false. We only
-/// have to check the fields in T1: T2 may be larger than T1.
+/// have to check the fields in T1: T2 may be larger than T1. If AllowLargerT1
+/// is true, then we also allow a larger T1.
///
-static bool ElementTypesAreCompatible(const Type *T1, const Type *T2) {
+static bool ElementTypesAreCompatible(const Type *T1, const Type *T2,
+ bool AllowLargerT1) {
TypeElementWalker T1W(T1), T2W(T2);
while (!T1W.isDone() && !T2W.isDone()) {
@@ -270,7 +272,7 @@ static bool ElementTypesAreCompatible(const Type *T1, const Type *T2) {
T2W.StepToNextType();
}
- return T1W.isDone();
+ return AllowLargerT1 || T1W.isDone();
}
@@ -327,8 +329,8 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
if (Ty == Type::VoidTy) {
// If this is the first type that this node has seen, just accept it without
// question....
- assert(Offset == 0 && "Cannot have an offset into a void node!");
- assert(!isArray() && "This shouldn't happen!");
+ assert(Offset == 0 && !isArray() &&
+ "Cannot have an offset into a void node!");
Ty = NewTy;
NodeType &= ~Array;
if (WillBeArray) NodeType |= Array;
@@ -424,7 +426,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
// just require each element in the node to be compatible.
if (NewTySize <= SubTypeSize && NewTySize && NewTySize < 256 &&
SubTypeSize && SubTypeSize < 256 &&
- ElementTypesAreCompatible(NewTy, SubType))
+ ElementTypesAreCompatible(NewTy, SubType, !isArray()))
return false;
// Okay, so we found the leader type at the offset requested. Search the list