From bac7da84610c31648ac9cecf719b3dfe7d1b3511 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 26 Apr 2004 14:44:08 +0000 Subject: [PATCH] If an object is not in the scalar map then it must be a global from another graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13173 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../DataStructure/DataStructureAA.cpp | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/Analysis/DataStructure/DataStructureAA.cpp b/lib/Analysis/DataStructure/DataStructureAA.cpp index 152e53ca555..99b57266329 100644 --- a/lib/Analysis/DataStructure/DataStructureAA.cpp +++ b/lib/Analysis/DataStructure/DataStructureAA.cpp @@ -111,45 +111,45 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size, const DSGraph::ScalarMapTy &GSM = G.getScalarMap(); DSGraph::ScalarMapTy::const_iterator I = GSM.find((Value*)V1); - if (I != GSM.end()) { - assert(I->second.getNode() && "Scalar map points to null node?"); - DSGraph::ScalarMapTy::const_iterator J = GSM.find((Value*)V2); - if (J != GSM.end()) { - assert(J->second.getNode() && "Scalar map points to null node?"); + if (I == GSM.end()) return NoAlias; - DSNode *N1 = I->second.getNode(), *N2 = J->second.getNode(); - unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset(); + assert(I->second.getNode() && "Scalar map points to null node?"); + DSGraph::ScalarMapTy::const_iterator J = GSM.find((Value*)V2); + if (J == GSM.end()) return NoAlias; + + assert(J->second.getNode() && "Scalar map points to null node?"); + + DSNode *N1 = I->second.getNode(), *N2 = J->second.getNode(); + unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset(); - // We can only make a judgment of one of the nodes is complete... - if (N1->isComplete() || N2->isComplete()) { - if (N1 != N2) - return NoAlias; // Completely different nodes. + // We can only make a judgment of one of the nodes is complete... + if (N1->isComplete() || N2->isComplete()) { + if (N1 != N2) + return NoAlias; // Completely different nodes. #if 0 // This does not correctly handle arrays! - // Both point to the same node and same offset, and there is only one - // physical memory object represented in the node, return must alias. - // - // FIXME: This isn't correct because we do not handle array indexing - // correctly. + // Both point to the same node and same offset, and there is only one + // physical memory object represented in the node, return must alias. + // + // FIXME: This isn't correct because we do not handle array indexing + // correctly. - if (O1 == O2 && isSinglePhysicalObject(N1)) - return MustAlias; // Exactly the same object & offset + if (O1 == O2 && isSinglePhysicalObject(N1)) + return MustAlias; // Exactly the same object & offset #endif - // See if they point to different offsets... if so, we may be able to - // determine that they do not alias... - if (O1 != O2) { - if (O2 < O1) { // Ensure that O1 <= O2 - std::swap(V1, V2); - std::swap(O1, O2); - std::swap(V1Size, V2Size); - } - - // FIXME: This is not correct because we do not handle array - // indexing correctly with this check! - //if (O1+V1Size <= O2) return NoAlias; - } + // See if they point to different offsets... if so, we may be able to + // determine that they do not alias... + if (O1 != O2) { + if (O2 < O1) { // Ensure that O1 <= O2 + std::swap(V1, V2); + std::swap(O1, O2); + std::swap(V1Size, V2Size); } + + // FIXME: This is not correct because we do not handle array + // indexing correctly with this check! + //if (O1+V1Size <= O2) return NoAlias; } }