summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2011-12-18 20:35:43 +0000
committerJoerg Sonnenberger <joerg@bec.de>2011-12-18 20:35:43 +0000
commitd6cb7649d8827f6ac9602f95482c3ed2bca93100 (patch)
tree7cccd952712204ff05ac2c62781a56ccb725d3a4 /llvm/test/Transforms
parent530b820500984764a37d4a2fed68eb75e9f7693c (diff)
downloadbcm5719-llvm-d6cb7649d8827f6ac9602f95482c3ed2bca93100.tar.gz
bcm5719-llvm-d6cb7649d8827f6ac9602f95482c3ed2bca93100.zip
Allow inlining of functions with returns_twice calls, if they have the
attribute themselve. llvm-svn: 146851
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/Inline/inline_returns_twice.ll41
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/inline_returns_twice.ll b/llvm/test/Transforms/Inline/inline_returns_twice.ll
new file mode 100644
index 00000000000..ab2e954af15
--- /dev/null
+++ b/llvm/test/Transforms/Inline/inline_returns_twice.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+
+; Check that functions with "returns_twice" calls are only inlined,
+; if they are themselve marked as such.
+
+declare i32 @a() returns_twice
+declare i32 @b() returns_twice
+
+define i32 @f() {
+entry:
+ %call = call i32 @a() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @g() {
+entry:
+; CHECK: define i32 @g
+; CHECK: call i32 @f()
+; CHECK-NOT: call i32 @a()
+ %call = call i32 @f()
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @h() returns_twice {
+entry:
+ %call = call i32 @b() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @i() {
+entry:
+; CHECK: define i32 @i
+; CHECK: call i32 @b()
+; CHECK-NOT: call i32 @h()
+ %call = call i32 @h() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
OpenPOWER on IntegriCloud