summaryrefslogtreecommitdiff
path: root/llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll
diff options
context:
space:
mode:
authorCharles Saternos <charles.saternos@gmail.com>2017-08-04 16:00:58 +0000
committerCharles Saternos <charles.saternos@gmail.com>2017-08-04 16:00:58 +0000
commit75da10d1b2db41f6789846ff499e2842cfe5de8e (patch)
tree18a69ad82b41d393cd3766c85cbb2a6c25b049f0 /llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll
parent79e7f6b3e394ad2f3b58581085847b4bb11fdc75 (diff)
[ThinLTO] Add FunctionAttrs to ThinLTO index
Adds function attributes to index: ReadNone, ReadOnly, NoRecurse, NoAlias. This attributes will be used for future ThinLTO optimizations that will propagate function attributes across modules. llvm-svn: 310061
Diffstat (limited to 'llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll')
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll b/llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll
new file mode 100644
index 000000000000..2ad49e3c8647
--- /dev/null
+++ b/llvm/test/Bitcode/thinlto-function-summary-functionattrs.ll
@@ -0,0 +1,27 @@
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+
+; CHECK: <GLOBALVAL_SUMMARY_BLOCK
+; ensure @f is marked readnone
+; CHECK: <PERMODULE {{.*}} op0=0 {{.*}} op3=1
+; ensure @g is marked readonly
+; CHECK: <PERMODULE {{.*}} op0=1 {{.*}} op3=2
+; ensure @h is marked norecurse
+; CHECK: <PERMODULE {{.*}} op0=2 {{.*}} op3=4
+; ensure @i is marked returndoesnotalias
+; CHECK: <PERMODULE {{.*}} op0=3 {{.*}} op3=8
+
+define void @f() readnone {
+ ret void
+}
+define void @g() readonly {
+ ret void
+}
+define void @h() norecurse {
+ ret void
+}
+
+define noalias i8* @i() {
+ %r = alloca i8
+ ret i8* %r
+}