summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-19 08:17:05 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-19 08:17:05 +0000
commitaf25ee7ffc1a73db10dfef04190bae22e08f742a (patch)
tree436f588c7e4eefa3d413b9879d02d1a47514eb47 /llvm/test/Transforms
parenta75815ebb030bc50791dcaa34a9a4c6f0628a146 (diff)
downloadbcm5719-llvm-af25ee7ffc1a73db10dfef04190bae22e08f742a.tar.gz
bcm5719-llvm-af25ee7ffc1a73db10dfef04190bae22e08f742a.zip
Add a new pass AddReadAttrs which works out which functions
can get the readnone/readonly attributes, and gives them it. The plan is to remove markmodref (which did the same thing by querying GlobalsModRef) and delete the analogous functionality from GlobalsModRef. llvm-svn: 56341
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll11
-rw-r--r--llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll9
-rw-r--r--llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll9
-rw-r--r--llvm/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll9
4 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll b/llvm/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll
new file mode 100644
index 00000000000..0a4f0855ca4
--- /dev/null
+++ b/llvm/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone
+
+define i32 @a() {
+ %tmp = call i32 @b( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+define i32 @b() {
+ %tmp = call i32 @a( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
diff --git a/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll b/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
new file mode 100644
index 00000000000..32719020040
--- /dev/null
+++ b/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone | count 2
+
+define i32 @f() {
+entry:
+ %tmp = call i32 @e( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+declare i32 @e() readnone
diff --git a/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll b/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll
new file mode 100644
index 00000000000..c08e7b12653
--- /dev/null
+++ b/llvm/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readonly | count 2
+
+define i32 @f() {
+entry:
+ %tmp = call i32 @e( ) ; <i32> [#uses=1]
+ ret i32 %tmp
+}
+
+declare i32 @e() readonly
diff --git a/llvm/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll b/llvm/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll
new file mode 100644
index 00000000000..0690083ae78
--- /dev/null
+++ b/llvm/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | not grep read
+; PR2792
+
+@g = global i32 0 ; <i32*> [#uses=1]
+
+define i32 @f() {
+ %t = volatile load i32* @g ; <i32> [#uses=1]
+ ret i32 %t
+}
OpenPOWER on IntegriCloud