From 088b639e3a168686f16bb292e08b952d01a25b7d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Mar 2003 17:13:31 +0000 Subject: [PATCH] Don't apply type information to load instructions if it will cause collapsing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5684 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/DataStructure.cpp | 11 ++++++----- lib/Analysis/DataStructure/Local.cpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 27247897e57..1aad8cf69ee 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -152,7 +152,8 @@ bool DSNode::isNodeCompletelyFolded() const { /// /// This method returns true if the node is completely folded, otherwise false. /// -bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) { +bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, + bool FoldIfIncompatible) { // Check to make sure the Size member is up-to-date. Size can be one of the // following: // Size = 0, Ty = Void: Nothing is known about this node. @@ -213,14 +214,14 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) { // It is illegal to grow this node if we have treated it as an array of // objects... if (isArray()) { - foldNodeCompletely(); + if (FoldIfIncompatible) foldNodeCompletely(); return true; } if (Offset) { // We could handle this case, but we don't for now... DEBUG(std::cerr << "UNIMP: Trying to merge a growth type into " << "offset != 0: Collapsing!\n"); - foldNodeCompletely(); + if (FoldIfIncompatible) foldNodeCompletely(); return true; } @@ -277,7 +278,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) { break; } default: - foldNodeCompletely(); + if (FoldIfIncompatible) foldNodeCompletely(); return true; } } @@ -356,7 +357,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) { << "\n due to:" << NewTy << " @ " << Offset << "!\n" << "SubType: " << SubType << "\n\n"); - foldNodeCompletely(); + if (FoldIfIncompatible) foldNodeCompletely(); return true; } diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index ffc80e73a6a..005580155d6 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -368,7 +368,7 @@ void GraphBuilder::visitLoadInst(LoadInst &LI) { Ptr.getNode()->NodeType |= DSNode::Read; // Ensure a typerecord exists... - Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset()); + Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset(), false); if (isPointerType(LI.getType())) setDestTo(LI, getLink(Ptr));