summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Inline/always-inline-attribute.ll
diff options
context:
space:
mode:
authorGerolf Hoflehner <ghoflehner@apple.com>2014-04-17 00:21:52 +0000
committerGerolf Hoflehner <ghoflehner@apple.com>2014-04-17 00:21:52 +0000
commit5f6268a40ee3e17bbec910329f5b4e8eb940069f (patch)
treeeec583a2ed9fe2a6cbe6d0a9c03892e3f7dddafc /llvm/test/Transforms/Inline/always-inline-attribute.ll
parentd0848a6fa8bb4ef5d9187c66dddc82bc610cbb79 (diff)
downloadbcm5719-llvm-5f6268a40ee3e17bbec910329f5b4e8eb940069f.tar.gz
bcm5719-llvm-5f6268a40ee3e17bbec910329f5b4e8eb940069f.zip
Inline a function when the always_inline attribute
is set even when it contains a indirect branch. The attribute overrules correctness concerns like the escape of a local block address. This is for rdar://16501761 llvm-svn: 206429
Diffstat (limited to 'llvm/test/Transforms/Inline/always-inline-attribute.ll')
-rw-r--r--llvm/test/Transforms/Inline/always-inline-attribute.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/always-inline-attribute.ll b/llvm/test/Transforms/Inline/always-inline-attribute.ll
new file mode 100644
index 00000000000..c146122e163
--- /dev/null
+++ b/llvm/test/Transforms/Inline/always-inline-attribute.ll
@@ -0,0 +1,26 @@
+; RUN: opt < %s -O3 -S | FileCheck %s
+@gv = external global i32
+
+define i32 @main() nounwind {
+; CHECK-NOT: call i32 @foo
+ %1 = load i32* @gv, align 4
+ %2 = tail call i32 @foo(i32 %1)
+ unreachable
+}
+
+define internal i32 @foo(i32) alwaysinline {
+ br label %2
+
+; <label>:2 ; preds = %8, %1
+ %3 = phi i32 [ %0, %1 ], [ %10, %8 ]
+ %4 = phi i8* [ blockaddress(@foo, %2), %1 ], [ %6, %8 ]
+ %5 = icmp eq i32 %3, 1
+ %6 = select i1 %5, i8* blockaddress(@foo, %8), i8* %4
+ %7 = add nsw i32 %3, -1
+ br label %8
+
+; <label>:8 ; preds = %8, %2
+ %9 = phi i32 [ %7, %2 ], [ %10, %8 ]
+ %10 = add nsw i32 %9, -1
+ indirectbr i8* %6, [label %2, label %8]
+}
OpenPOWER on IntegriCloud