Add writeonly IR attribute
Summary:
This complements the earlier addition of IntrWriteMem and IntrWriteArgMem
LLVM intrinsic properties, see D18291.
Also start using the attribute for memset, memcpy, and memmove intrinsics,
and remove their special-casing in BasicAliasAnalysis.
Reviewers: reames, joker.eph
Subscribers: joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D18714
llvm-svn: 274485
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 263dd48..a9d4610 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -142,6 +142,8 @@
if (onlyReadsMemory(MRB))
Result = ModRefInfo(Result & MRI_Ref);
+ else if (doesNotReadMemory(MRB))
+ Result = ModRefInfo(Result & MRI_Mod);
if (onlyAccessesArgPointees(MRB)) {
bool DoesAlias = false;
@@ -207,6 +209,8 @@
// from CS1 reading memory written by CS2.
if (onlyReadsMemory(CS1B))
Result = ModRefInfo(Result & MRI_Ref);
+ else if (doesNotReadMemory(CS1B))
+ Result = ModRefInfo(Result & MRI_Mod);
// If CS2 only access memory through arguments, accumulate the mod/ref
// information from CS1's references to the memory referenced by