summaryrefslogtreecommitdiff
path: root/test/Transforms/Inline
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-04-01 10:21:05 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-04-01 10:21:05 +0000
commit6052eef8bd701b30a0ab5749296671ca34389c39 (patch)
tree829e0a222fd59a3cdea969cd34a8e1e43bea8a8b /test/Transforms/Inline
parent0b42f9dd2fb166190c7ebd9b6e6925f59db4f205 (diff)
downloadllvm-6052eef8bd701b30a0ab5749296671ca34389c39.tar.gz
llvm-6052eef8bd701b30a0ab5749296671ca34389c39.tar.bz2
llvm-6052eef8bd701b30a0ab5749296671ca34389c39.tar.xz
Fix a pretty scary bug I introduced into the always inliner with
a single missing character. Somehow, this had gone untested. I've added tests for returns-twice logic specifically with the always-inliner that would have caught this, and fixed the bug. Thanks to Matt for the careful review and spotting this!!! =D git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Inline')
-rw-r--r--test/Transforms/Inline/always-inline.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Transforms/Inline/always-inline.ll b/test/Transforms/Inline/always-inline.ll
index 40091d7518..bfd8762713 100644
--- a/test/Transforms/Inline/always-inline.ll
+++ b/test/Transforms/Inline/always-inline.ll
@@ -40,3 +40,41 @@ define void @outer2(i32 %N) {
call void @inner2( i32 %N )
ret void
}
+
+declare i32 @a() returns_twice
+declare i32 @b() returns_twice
+
+define i32 @inner3() alwaysinline {
+entry:
+ %call = call i32 @a() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+define i32 @outer3() {
+entry:
+; CHECK: @outer3
+; CHECK-NOT: call i32 @a
+; CHECK: ret
+
+ %call = call i32 @inner3()
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @inner4() alwaysinline returns_twice {
+entry:
+ %call = call i32 @b() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}
+
+define i32 @outer4() {
+entry:
+; CHECK: @outer4
+; CHECK: call i32 @b()
+; CHECK: ret
+
+ %call = call i32 @inner4() returns_twice
+ %add = add nsw i32 1, %call
+ ret i32 %add
+}