summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-04-04 21:46:27 +0000
committerVitaly Buka <vitalybuka@google.com>2018-04-04 21:46:27 +0000
commit4296ea72ffcef9fff5ce735dbbfeccd503200735 (patch)
tree3cf48d768dd020e83918d03a7e6e30177b7f0990 /llvm/test/Transforms
parente00799ea04406d69195cf6592abcb348b7ee3ae0 (diff)
downloadbcm5719-llvm-4296ea72ffcef9fff5ce735dbbfeccd503200735.tar.gz
bcm5719-llvm-4296ea72ffcef9fff5ce735dbbfeccd503200735.zip
Don't inline @llvm.icall.branch.funnel
Summary: @llvm.icall.branch.funnel is musttail with variable number of arguments. After inlining current backend can't separate call targets from call arguments. Reviewers: pcc Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45116 llvm-svn: 329235
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/Inline/inline-brunch-funnel.ll35
-rw-r--r--llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll20
2 files changed, 49 insertions, 6 deletions
diff --git a/llvm/test/Transforms/Inline/inline-brunch-funnel.ll b/llvm/test/Transforms/Inline/inline-brunch-funnel.ll
new file mode 100644
index 00000000000..54c6600c038
--- /dev/null
+++ b/llvm/test/Transforms/Inline/inline-brunch-funnel.ll
@@ -0,0 +1,35 @@
+; Test that inliner skips @llvm.icall.branch.funnel
+; RUN: opt < %s -inline -S | FileCheck %s
+
+target datalayout = "e-p:64:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare void @llvm.icall.branch.funnel(...)
+
+; CHECK-LABEL: define void @fn_musttail(
+define void @fn_musttail() {
+ call void (...) @bf_musttail()
+ ; CHECK: call void (...) @bf_musttail(
+ ret void
+}
+
+; CHECK-LABEL: define internal void @bf_musttail(
+define internal void @bf_musttail(...) {
+ musttail call void (...) @llvm.icall.branch.funnel(...)
+ ; CHECK: musttail call void (...) @llvm.icall.branch.funnel(
+ ret void
+}
+
+; CHECK-LABEL: define void @fn_musttail_always(
+define void @fn_musttail_always() {
+ call void (...) @bf_musttail_always()
+ ; CHECK: call void (...) @bf_musttail_always(
+ ret void
+}
+
+; CHECK-LABEL: define internal void @bf_musttail_always(
+define internal void @bf_musttail_always(...) alwaysinline {
+ musttail call void (...) @llvm.icall.branch.funnel(...)
+ ; CHECK: musttail call void (...) @llvm.icall.branch.funnel(
+ ret void
+}
diff --git a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
index 3b971f04d59..cea82050f99 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
@@ -1,6 +1,10 @@
; RUN: opt -S -wholeprogramdevirt %s | FileCheck --check-prefixes=CHECK,RETP %s
; RUN: sed -e 's,+retpoline,-retpoline,g' %s | opt -S -wholeprogramdevirt | FileCheck --check-prefixes=CHECK,NORETP %s
+
; RUN: opt -wholeprogramdevirt -wholeprogramdevirt-summary-action=export -wholeprogramdevirt-read-summary=%S/Inputs/export.yaml -wholeprogramdevirt-write-summary=%t -S -o - %s | FileCheck --check-prefixes=CHECK,RETP %s
+
+; RUN: opt -wholeprogramdevirt -wholeprogramdevirt-summary-action=export -wholeprogramdevirt-read-summary=%S/Inputs/export.yaml -wholeprogramdevirt-write-summary=%t -O3 -S -o - %s | FileCheck --check-prefixes=CHECK %s
+
; RUN: FileCheck --check-prefix=SUMMARY %s < %t
; SUMMARY: TypeIdMap:
@@ -89,7 +93,10 @@ declare i32 @vf3_2(i8* %this, i32 %arg)
declare i32 @vf4_1(i8* %this, i32 %arg)
declare i32 @vf4_2(i8* %this, i32 %arg)
-; CHECK: define i32 @fn1
+
+
+; CHECK-LABEL: define i32 @fn1
+; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
define i32 @fn1(i8* %obj) #0 {
%vtableptr = bitcast i8* %obj to [1 x i8*]**
%vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
@@ -107,7 +114,8 @@ define i32 @fn1(i8* %obj) #0 {
ret i32 %result
}
-; CHECK: define i32 @fn2
+; CHECK-LABEL: define i32 @fn2
+; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
define i32 @fn2(i8* %obj) #0 {
%vtableptr = bitcast i8* %obj to [1 x i8*]**
%vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
@@ -122,7 +130,8 @@ define i32 @fn2(i8* %obj) #0 {
ret i32 %result
}
-; CHECK: define i32 @fn3
+; CHECK-LABEL: define i32 @fn3
+; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
define i32 @fn3(i8* %obj) #0 {
%vtableptr = bitcast i8* %obj to [1 x i8*]**
%vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
@@ -138,10 +147,9 @@ define i32 @fn3(i8* %obj) #0 {
ret i32 %result
}
-; CHECK: define internal void @branch_funnel(i8* nest, ...)
-
+; CHECK-LABEL: define internal void @branch_funnel(i8*
; CHECK: define hidden void @__typeid_typeid1_0_branch_funnel(i8* nest, ...)
-; CHECK-NEXT: call void (...) @llvm.icall.branch.funnel(i8* %0, i8* bitcast ([1 x i8*]* @vt1_1 to i8*), i32 (i8*, i32)* @vf1_1, i8* bitcast ([1 x i8*]* @vt1_2 to i8*), i32 (i8*, i32)* @vf1_2, ...)
+; CHECK-NEXT: musttail call void (...) @llvm.icall.branch.funnel(i8* %0, i8* bitcast ([1 x i8*]* {{(nonnull )?}}@vt1_1 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_1, i8* bitcast ([1 x i8*]* {{(nonnull )?}}@vt1_2 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_2, ...)
declare i1 @llvm.type.test(i8*, metadata)
declare void @llvm.assume(i1)
OpenPOWER on IntegriCloud