diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-27 02:28:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-27 02:28:41 +0000 |
commit | ee7eafa054cfe41cd3cff7692cc61e77f272a47f (patch) | |
tree | 7daf845e3df5c27ba442a27b759eafeb2b848965 /lib/Analysis | |
parent | 2aa51be083ccc8872caa770d13e9e06fd7237eea (diff) | |
download | external_llvm-ee7eafa054cfe41cd3cff7692cc61e77f272a47f.zip external_llvm-ee7eafa054cfe41cd3cff7692cc61e77f272a47f.tar.gz external_llvm-ee7eafa054cfe41cd3cff7692cc61e77f272a47f.tar.bz2 |
Add support for tracking array allocations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/DataStructure/EliminateNodes.cpp | 1 | ||||
-rw-r--r-- | lib/Analysis/DataStructure/NodeImpl.cpp | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/EliminateNodes.cpp b/lib/Analysis/DataStructure/EliminateNodes.cpp index edd8285..8a4ee82 100644 --- a/lib/Analysis/DataStructure/EliminateNodes.cpp +++ b/lib/Analysis/DataStructure/EliminateNodes.cpp @@ -53,6 +53,7 @@ static void DestroyFirstNodeOfPair(DSNode *N1, DSNode *N2) { assert(RanOnce && "Node on user set but cannot find the use!"); } + N1->mergeInto(N2); N1->removeAllIncomingEdges(); delete N1; } diff --git a/lib/Analysis/DataStructure/NodeImpl.cpp b/lib/Analysis/DataStructure/NodeImpl.cpp index 46c12e3..76b82ba 100644 --- a/lib/Analysis/DataStructure/NodeImpl.cpp +++ b/lib/Analysis/DataStructure/NodeImpl.cpp @@ -21,6 +21,12 @@ bool AllocDSNode::isEquivalentTo(DSNode *Node) const { return false; } +void AllocDSNode::mergeInto(DSNode *Node) const { + // Make sure the merged node is variable size if this node is var size + AllocDSNode *N = cast<AllocDSNode>(Node); + N->isVarSize |= isVarSize; +} + bool GlobalDSNode::isEquivalentTo(DSNode *Node) const { if (GlobalDSNode *G = dyn_cast<GlobalDSNode>(Node)) { if (G->Val != Val) return false; @@ -217,8 +223,12 @@ void DSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap, const DSNode *Old) { (ShadowDSNode*)NodeMap[Old->SynthNodes[i].second])); } -AllocDSNode::AllocDSNode(AllocationInst *V) +AllocDSNode::AllocDSNode(AllocationInst *V, bool isvarsize) : DSNode(NewNode, V->getType()->getElementType()), Allocation(V) { + + // Is variable size if incoming flag says so, or if allocation is var size + // already. + isVarSize = isvarsize || !isa<Constant>(V->getArraySize()); } bool AllocDSNode::isAllocaNode() const { @@ -232,7 +242,7 @@ string AllocDSNode::getCaption() const { WriteTypeSymbolic(OS, getType(), Allocation->getParent()->getParent()->getParent()); - if (Allocation->isArrayAllocation()) + if (isVarSize) OS << "[ ]"; return OS.str(); } |