OSDN Git Service

Intrinsics don't read these kinds of global
authorDuncan Sands <baldrick@free.fr>
Thu, 11 Sep 2008 15:43:12 +0000 (15:43 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 11 Sep 2008 15:43:12 +0000 (15:43 +0000)
variables.

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

lib/Analysis/IPA/GlobalsModRef.cpp

index 70680bf..6063a1d 100644 (file)
@@ -384,11 +384,13 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
           // Can't do better than that!
         } else if (F->onlyReadsMemory()) {
           FunctionEffect |= Ref;
-          // This function might call back into the module and read a global, so
-          // mark all globals read somewhere as being read by this function.
-          for (std::set<GlobalValue*>::iterator GI = ReadGlobals.begin(),
-               E = ReadGlobals.end(); GI != E; ++GI)
-            FR.GlobalInfo[*GI] |= Ref;
+          if (!F->isIntrinsic()) {
+            // This function might call back into the module and read a global -
+            // mark all globals read somewhere as being read by this function.
+            for (std::set<GlobalValue*>::iterator GI = ReadGlobals.begin(),
+                 E = ReadGlobals.end(); GI != E; ++GI)
+              FR.GlobalInfo[*GI] |= Ref;
+          }
         } else {
           // Can't say anything useful.
           KnowNothing = true;