If an object is not in the scalar map then it must be a global from another
authorChris Lattner <sabre@nondot.org>
Mon, 26 Apr 2004 14:44:08 +0000 (14:44 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 26 Apr 2004 14:44:08 +0000 (14:44 +0000)
graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13173 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructureAA.cpp

index 152e53ca5555b7f3fb1048c6b7961c69eca5827f..99b57266329ff95b63cdb1205d6df697a0bfbe9c 100644 (file)
@@ -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?");
-
-      DSNode  *N1 = I->second.getNode(),  *N2 = J->second.getNode();
-      unsigned O1 = I->second.getOffset(), O2 = J->second.getOffset();
+  if (I == GSM.end()) return NoAlias;
+
+  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.
-
-        if (O1 == O2 && isSinglePhysicalObject(N1))
-          return MustAlias; // Exactly the same object & offset
+    // 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
 #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;
     }
   }