aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-04-01 10:36:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-04-01 10:36:17 +0000
commit48ec3b50e7fae0cdb8c83fb33423cb3e93a6270e (patch)
treee0ee5182788aaac65cbacc81bae6156fe360b4aa /test/Transforms
parent6052eef8bd701b30a0ab5749296671ca34389c39 (diff)
downloadexternal_llvm-48ec3b50e7fae0cdb8c83fb33423cb3e93a6270e.zip
external_llvm-48ec3b50e7fae0cdb8c83fb33423cb3e93a6270e.tar.gz
external_llvm-48ec3b50e7fae0cdb8c83fb33423cb3e93a6270e.tar.bz2
Add some more testing to cover the remaining two cases where
always-inlining is disabled: recursive functions and indirectbr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/Inline/always-inline.ll45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/Transforms/Inline/always-inline.ll b/test/Transforms/Inline/always-inline.ll
index bfd8762..e0be41f 100644
--- a/test/Transforms/Inline/always-inline.ll
+++ b/test/Transforms/Inline/always-inline.ll
@@ -78,3 +78,48 @@ entry:
%add = add nsw i32 1, %call
ret i32 %add
}
+
+define i32 @inner5(i8* %addr) alwaysinline {
+entry:
+ indirectbr i8* %addr, [ label %one, label %two ]
+
+one:
+ ret i32 42
+
+two:
+ ret i32 44
+}
+define i32 @outer5(i32 %x) {
+; CHECK: @outer5
+; CHECK: call i32 @inner5
+; CHECK: ret
+
+ %cmp = icmp slt i32 %x, 42
+ %addr = select i1 %cmp, i8* blockaddress(@inner5, %one), i8* blockaddress(@inner5, %two)
+ %call = call i32 @inner5(i8* %addr)
+ ret i32 %call
+}
+
+define void @inner6(i32 %x) alwaysinline {
+entry:
+ %icmp = icmp slt i32 %x, 0
+ br i1 %icmp, label %return, label %bb
+
+bb:
+ %sub = sub nsw i32 %x, 1
+ call void @inner6(i32 %sub)
+ ret void
+
+return:
+ ret void
+}
+define void @outer6() {
+; CHECK: @outer6
+; CHECK: call void @inner6(i32 42)
+; CHECK: ret
+
+entry:
+ call void @inner6(i32 42)
+ ret void
+}
+