diff options
author | Chris Lattner <sabre@nondot.org> | 2005-03-17 19:56:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-03-17 19:56:56 +0000 |
commit | 94f8470fe38a51b998ab5bc4e195ef82fef07eb5 (patch) | |
tree | 91ef2ff0e0bd3fce8bb656333cc80cbc8def2f3c /lib/Analysis/DataStructure/DataStructure.cpp | |
parent | 2e2cce69bcd8f0ce55e147cefe21935c2d9355b1 (diff) |
Clean up some code, handle null pointer specially to avoid an assertion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/DataStructure.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 8857664d51..4c48a86d39 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/DataStructure/DSGraphTraits.h" +#include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/Instructions.h" @@ -424,10 +425,6 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, // hit the other code path here. If the other code path decides it's not // ok, it will collapse the node as appropriate. // - const Type *OldTy = Ty; - Ty = NewTy; - NodeType &= ~Array; - if (WillBeArray) NodeType |= Array; // If this node would have to have an unreasonable number of fields, just // collapse it. This can occur for fortran common blocks, which have stupid @@ -438,10 +435,14 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, return true; } + const Type *OldTy = Ty; + Ty = NewTy; + NodeType &= ~Array; + if (WillBeArray) NodeType |= Array; Size = NewTySize; // Must grow links to be the appropriate size... - Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift); + Links.resize(NumFields); // Merge in the old type now... which is guaranteed to be smaller than the // "current" type. @@ -1446,7 +1447,10 @@ DSCallSite DSGraph::getDSCallSiteForCallSite(CallSite CS) const { // Calculate the arguments vector... for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) if (isPointerType((*I)->getType())) - Args.push_back(getNodeForValue(*I)); + if (isa<ConstantPointerNull>(*I)) + Args.push_back(DSNodeHandle()); + else + Args.push_back(getNodeForValue(*I)); // Add a new function call entry... if (Function *F = CS.getCalledFunction()) |