diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/MemorySSA.cpp | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 6d166da75b9..f1b60c6432b 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -580,20 +580,11 @@ FunctionModRefBehavior BasicAAResult::getModRefBehavior(ImmutableCallSite CS) { /// Returns the behavior when calling the given function. For use when the call /// site is not known. -/// NOTE: Because of the special case handling of llvm.assume below, the result -/// of this function may not match similar results derived from function -/// attributes (e.g. "readnone"). FunctionModRefBehavior BasicAAResult::getModRefBehavior(const Function *F) { // If the function declares it doesn't access memory, we can't do better. if (F->doesNotAccessMemory()) return FMRB_DoesNotAccessMemory; - // While the assume intrinsic is marked as arbitrarily writing so that - // proper control dependencies will be maintained, it never aliases any - // actual memory locations. - if (F->getIntrinsicID() == Intrinsic::assume) - return FMRB_DoesNotAccessMemory; - FunctionModRefBehavior Min = FMRB_UnknownModRefBehavior; // If the function declares it only reads memory, go with that. diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp index b87a6d611b1..9d8c0884fdb 100644 --- a/llvm/lib/Transforms/Utils/MemorySSA.cpp +++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp @@ -354,6 +354,14 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA, /// \brief Helper function to create new memory accesses MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I) { + // The assume intrinsic has a control dependency which we model by claiming + // that it writes arbitrarily. Ignore that fake memory dependency here. + // FIXME: Replace this special casing with a more accurate modelling of + // assume's control dependency. + if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) + if (II->getIntrinsicID() == Intrinsic::assume) + return nullptr; + // Find out what affect this instruction has on memory. ModRefInfo ModRef = AA->getModRefInfo(I); bool Def = bool(ModRef & MRI_Mod); |