From: Chris Lattner Date: Fri, 30 Jan 2004 22:16:42 +0000 (+0000) Subject: Improve mod/ref information based on the pointsToConstantMemory method. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4d904d7e326c9cbed497ca681b6270170fd2020;p=oota-llvm.git Improve mod/ref information based on the pointsToConstantMemory method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11021 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index c881ec283a9..373524b6c15 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -44,8 +44,15 @@ AliasAnalysis::getModRefInfo(LoadInst *L, Value *P, unsigned Size) { AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo(StoreInst *S, Value *P, unsigned Size) { - return alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()), - P, Size) ? Mod : NoModRef; + // If the stored address cannot alias the pointer in question, then the + // pointer cannot be modified by the store. + if (!alias(S->getOperand(1), TD->getTypeSize(S->getOperand(0)->getType()), + P, Size)) + return NoModRef; + + // If the pointer is a pointer to constant memory, then it could not have been + // modified by this store. + return pointsToConstantMemory(P) ? NoModRef : Mod; }