Reduce amount of work we do calculating mustaliases if the arg is a global
authorChris Lattner <sabre@nondot.org>
Wed, 2 Jul 2003 04:39:13 +0000 (04:39 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 2 Jul 2003 04:39:13 +0000 (04:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7062 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructureAA.cpp

index bb28389e562bb0849832c07e2298eb8d542f4d7b..4940e9d0fc591bf12d301411ea698d430ed67375 100644 (file)
@@ -146,17 +146,22 @@ AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
 /// specified vector.
 ///
 void DSAA::getMustAliases(Value *P, std::vector<Value*> &RetVals) {
-  DSGraph *G = getGraphForValue(P);
-  if (!G) G = &TD->getGlobalsGraph();
-  
-  // The only must alias information we can currently determine occurs when the
-  // node for P is a global node with only one entry.
-  const DSGraph::ScalarMapTy &GSM = G->getScalarMap();
-  DSGraph::ScalarMapTy::const_iterator I = GSM.find(P);
-  if (I != GSM.end()) {
-    DSNode *N = I->second.getNode();
-    if (isSinglePhysicalObject(N))
-      RetVals.push_back(N->getGlobals()[0]);
+  // Currently the only must alias information we can provide is to say that
+  // something is equal to a global value. If we already have a global value,
+  // don't get worked up about it.
+  if (!isa<GlobalValue>(P)) {
+    DSGraph *G = getGraphForValue(P);
+    if (!G) G = &TD->getGlobalsGraph();
+    
+    // The only must alias information we can currently determine occurs when
+    // the node for P is a global node with only one entry.
+    const DSGraph::ScalarMapTy &GSM = G->getScalarMap();
+    DSGraph::ScalarMapTy::const_iterator I = GSM.find(P);
+    if (I != GSM.end()) {
+      DSNode *N = I->second.getNode();
+      if (N->isComplete() && isSinglePhysicalObject(N))
+        RetVals.push_back(N->getGlobals()[0]);
+    }
   }
 
   return getAnalysis<AliasAnalysis>().getMustAliases(P, RetVals);