1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Revert r44626, which turned off the use of readonly

and readnone for functions with bodies because it
broke llvm-gcc-4.2 bootstrap.  It turns out that,
because of LLVM's array_ref hack, gcc was computing
pure/const attributes wrong (now fixed by turning
off the gcc ipa-pure-const pass).

llvm-svn: 44937
This commit is contained in:
Duncan Sands 2007-12-12 16:01:40 +00:00
parent 8bb1d9e67c
commit 998cd21867
2 changed files with 4 additions and 15 deletions

View File

@ -116,17 +116,13 @@ AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) {
AliasAnalysis::ModRefBehavior AliasAnalysis::ModRefBehavior
AliasAnalysis::getModRefBehavior(CallSite CS, AliasAnalysis::getModRefBehavior(CallSite CS,
std::vector<PointerAccessInfo> *Info) { 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. // Can't do better than this.
return DoesNotAccessMemory; return DoesNotAccessMemory;
ModRefBehavior MRB = UnknownModRefBehavior; ModRefBehavior MRB = UnknownModRefBehavior;
if (Function *F = CS.getCalledFunction()) if (Function *F = CS.getCalledFunction())
MRB = getModRefBehavior(F, CS, Info); 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 OnlyReadsMemory;
return MRB; return MRB;
} }
@ -134,15 +130,11 @@ AliasAnalysis::getModRefBehavior(CallSite CS,
AliasAnalysis::ModRefBehavior AliasAnalysis::ModRefBehavior
AliasAnalysis::getModRefBehavior(Function *F, AliasAnalysis::getModRefBehavior(Function *F,
std::vector<PointerAccessInfo> *Info) { std::vector<PointerAccessInfo> *Info) {
if (F->doesNotAccessMemory() && if (F->doesNotAccessMemory())
// FIXME: workaround gcc bootstrap breakage
F->isDeclaration())
// Can't do better than this. // Can't do better than this.
return DoesNotAccessMemory; return DoesNotAccessMemory;
ModRefBehavior MRB = getModRefBehavior(F, CallSite(), Info); 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 OnlyReadsMemory;
return MRB; return MRB;
} }

View File

@ -13,7 +13,6 @@
#include "llvm/Type.h" #include "llvm/Type.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h" // FIXME: remove
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Support/LeakDetector.h" #include "llvm/Support/LeakDetector.h"
@ -209,8 +208,6 @@ bool Instruction::mayWriteToMemory() const {
case Instruction::VAArg: case Instruction::VAArg:
return true; return true;
case Instruction::Call: case Instruction::Call:
if (!isa<IntrinsicInst>(this))
return true; // FIXME: workaround gcc bootstrap breakage
return !cast<CallInst>(this)->onlyReadsMemory(); return !cast<CallInst>(this)->onlyReadsMemory();
case Instruction::Load: case Instruction::Load:
return cast<LoadInst>(this)->isVolatile(); return cast<LoadInst>(this)->isVolatile();