From 27236ac089e51c28e5f36a90d44f286c5efbc921 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 2 Oct 2002 06:24:29 +0000 Subject: [PATCH] * Implement fully general merging of array subscripts on demand! This does not handle the initial pointer index case yet though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4011 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DSGraph.h | 12 ++++++++++++ include/llvm/Analysis/DataStructure/DSGraph.h | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h index af2105576e0..d2e18063274 100644 --- a/include/llvm/Analysis/DSGraph.h +++ b/include/llvm/Analysis/DSGraph.h @@ -209,6 +209,18 @@ public: /// void mergeWith(const DSNodeHandle &NH, unsigned Offset); + /// mergeIndexes - If we discover that two indexes are equivalent and must be + /// merged, this function is used to do the dirty work. + /// + void mergeIndexes(unsigned idx1, unsigned idx2) { + assert(idx1 < getSize() && idx2 < getSize() && "Indexes out of range!"); + signed char MV1 = MergeMap[idx1]; + signed char MV2 = MergeMap[idx2]; + if (MV1 != MV2) + mergeMappedValues(MV1, MV2); + } + + /// addGlobal - Add an entry for a global value to the Globals list. This /// also marks the node with the 'G' flag if it does not already have it. /// diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index af2105576e0..d2e18063274 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -209,6 +209,18 @@ public: /// void mergeWith(const DSNodeHandle &NH, unsigned Offset); + /// mergeIndexes - If we discover that two indexes are equivalent and must be + /// merged, this function is used to do the dirty work. + /// + void mergeIndexes(unsigned idx1, unsigned idx2) { + assert(idx1 < getSize() && idx2 < getSize() && "Indexes out of range!"); + signed char MV1 = MergeMap[idx1]; + signed char MV2 = MergeMap[idx2]; + if (MV1 != MV2) + mergeMappedValues(MV1, MV2); + } + + /// addGlobal - Add an entry for a global value to the Globals list. This /// also marks the node with the 'G' flag if it does not already have it. /// -- 2.34.1