Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
authorDuncan Sands <baldrick@free.fr>
Wed, 5 Dec 2007 21:03:28 +0000 (21:03 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 5 Dec 2007 21:03:28 +0000 (21:03 +0000)
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.

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

lib/Analysis/AliasAnalysis.cpp
lib/VMCore/Instruction.cpp

index 12ea937fa921a620411cd2262a9f5db2911ba93e..fe3f41a9ce8fd814b9e3140abb4534ff313b2dd0 100644 (file)
@@ -116,13 +116,17 @@ AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) {
 AliasAnalysis::ModRefBehavior
 AliasAnalysis::getModRefBehavior(CallSite CS,
                                  std::vector<PointerAccessInfo> *Info) {
-  if (CS.doesNotAccessMemory())
+  if (CS.doesNotAccessMemory() &&
+      // FIXME: workaround gcc bootstrap breakage
+      CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration())
     // Can't do better than this.
     return DoesNotAccessMemory;
   ModRefBehavior MRB = UnknownModRefBehavior;
   if (Function *F = CS.getCalledFunction())
     MRB = getModRefBehavior(F, CS, Info);
-  if (MRB != DoesNotAccessMemory && CS.onlyReadsMemory())
+  if (MRB != DoesNotAccessMemory && CS.onlyReadsMemory() &&
+      // FIXME: workaround gcc bootstrap breakage
+      CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration())
     return OnlyReadsMemory;
   return MRB;
 }
@@ -130,11 +134,15 @@ AliasAnalysis::getModRefBehavior(CallSite CS,
 AliasAnalysis::ModRefBehavior
 AliasAnalysis::getModRefBehavior(Function *F,
                                  std::vector<PointerAccessInfo> *Info) {
-  if (F->doesNotAccessMemory())
+  if (F->doesNotAccessMemory() &&
+      // FIXME: workaround gcc bootstrap breakage
+      F->isDeclaration())
     // Can't do better than this.
     return DoesNotAccessMemory;
   ModRefBehavior MRB = getModRefBehavior(F, CallSite(), Info);
-  if (MRB != DoesNotAccessMemory && F->onlyReadsMemory())
+  if (MRB != DoesNotAccessMemory && F->onlyReadsMemory() &&
+      // FIXME: workaround gcc bootstrap breakage
+      F->isDeclaration())
     return OnlyReadsMemory;
   return MRB;
 }
index 9b208854ba12e0d0feb20b709a58647cf60a3d70..7fc6245f6da5b526251e837c7a760f317467e08c 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "llvm/Type.h"
 #include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h" // FIXME: remove
 #include "llvm/Function.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/LeakDetector.h"
@@ -208,6 +209,8 @@ bool Instruction::mayWriteToMemory() const {
   case Instruction::VAArg:
     return true;
   case Instruction::Call:
+    if (!isa<IntrinsicInst>(this))
+      return true; // FIXME: workaround gcc bootstrap breakage
     return !cast<CallInst>(this)->onlyReadsMemory();
   case Instruction::Load:
     return cast<LoadInst>(this)->isVolatile();