summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/IR/Function.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h
index cfb862d9b0..455469d1fa 100644
--- a/include/llvm/IR/Function.h
+++ b/include/llvm/IR/Function.h
@@ -310,9 +310,16 @@ public:
addAttribute(n, Attribute::NoCapture);
}
+ bool doesNotAccessMemory(unsigned n) const {
+ return AttributeSets.hasAttribute(n, Attribute::ReadNone);
+ }
+ void setDoesNotAccessMemory(unsigned n) {
+ addAttribute(n, Attribute::ReadNone);
+ }
+
bool onlyReadsMemory(unsigned n) const {
- return AttributeSets.hasAttribute(n, Attribute::ReadOnly) ||
- AttributeSets.hasAttribute(n, Attribute::ReadNone);
+ return doesNotAccessMemory(n) ||
+ AttributeSets.hasAttribute(n, Attribute::ReadOnly);
}
void setOnlyReadsMemory(unsigned n) {
addAttribute(n, Attribute::ReadOnly);