summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2018-09-11 11:51:29 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2018-09-11 11:51:29 +0000
commitae3cfeb3ad0e4d3d8846d83c4b75e2933f043800 (patch)
treefffad3bbd776614ad61cf784350e56e88970e1c1 /llvm/test
parenta58e9214ac6adc67e1a9229c7e8cea04819547a6 (diff)
downloadbcm5719-llvm-ae3cfeb3ad0e4d3d8846d83c4b75e2933f043800.tar.gz
bcm5719-llvm-ae3cfeb3ad0e4d3d8846d83c4b75e2933f043800.zip
[FuncAttrs] Remove "access range attributes" for read-none functions
The presence of readnone and an access range attribute (argmemonly, inaccessiblememonly, inaccessiblemem_or_argmemonly) is considered an error by the verifier. This seems strict but also not wrong. This patch makes sure function attribute detection will remove all access range attributes for readnone functions. llvm-svn: 341927
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll b/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
new file mode 100644
index 00000000000..79af817ff03
--- /dev/null
+++ b/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -o - -functionattrs %s | FileCheck %s
+; RUN: opt -S -o - -passes=function-attrs %s | FileCheck %s
+
+; Verify we remove argmemonly/inaccessiblememonly/inaccessiblemem_or_argmemonly
+; function attributes when we derive readnone.
+
+; Function Attrs: argmemonly
+define i32* @given_argmem_infer_readnone(i32* %p) #0 {
+; CHECK: define i32* @given_argmem_infer_readnone(i32* readnone returned %p) #0 {
+entry:
+ ret i32* %p
+}
+
+; Function Attrs: inaccessiblememonly
+define i32* @given_inaccessible_infer_readnone(i32* %p) #1 {
+; CHECK: define i32* @given_inaccessible_infer_readnone(i32* readnone returned %p) #0 {
+entry:
+ ret i32* %p
+}
+
+; Function Attrs: inaccessiblemem_or_argmemonly
+define i32* @given_inaccessible_or_argmem_infer_readnone(i32* %p) #2 {
+; CHECK: define i32* @given_inaccessible_or_argmem_infer_readnone(i32* readnone returned %p) #0 {
+entry:
+ ret i32* %p
+}
+
+attributes #0 = { argmemonly }
+attributes #1 = { inaccessiblememonly }
+attributes #2 = { inaccessiblemem_or_argmemonly }
+; CHECK: attributes #0 = { norecurse nounwind readnone }
+; CHECK-NOT: attributes
OpenPOWER on IntegriCloud