summaryrefslogtreecommitdiff
path: root/test/Transforms/MergeFunc
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2015-09-10 18:08:35 +0000
committerJF Bastien <jfb@google.com>2015-09-10 18:08:35 +0000
commit50c9e6310eceb4696b3fb7ea9845cd9c868d4dfc (patch)
treedc201d44f7c297a10fd019f9f8379c61d9a8c0b7 /test/Transforms/MergeFunc
parent6ff608fb18a8d0613885b0a6d947c55924ae76ad (diff)
[MergeFuncs] Fix callsite attributes in thunk generation
This change correctly sets the attributes on the callsites generated in thunks. This makes sure things such as sret, sext, etc. are correctly set, so that the call can be a proper tailcall. Also, the transfer of attributes in the replaceDirectCallers function appears to be unnecessary, but until this is confirmed it will remain. Author: jrkoenig Reviewers: dschuff, jfb Subscribers: llvm-commits, nlewycky Differential revision: http://reviews.llvm.org/D12581 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/MergeFunc')
-rw-r--r--test/Transforms/MergeFunc/apply_function_attributes.ll7
-rw-r--r--test/Transforms/MergeFunc/inttoptr-address-space.ll2
-rw-r--r--test/Transforms/MergeFunc/inttoptr.ll2
3 files changed, 9 insertions, 2 deletions
diff --git a/test/Transforms/MergeFunc/apply_function_attributes.ll b/test/Transforms/MergeFunc/apply_function_attributes.ll
index fa7f052f7ff..e9ede451820 100644
--- a/test/Transforms/MergeFunc/apply_function_attributes.ll
+++ b/test/Transforms/MergeFunc/apply_function_attributes.ll
@@ -38,3 +38,10 @@ define void @A(%Opaque_type* sret %a, %D2i* %b, i32* %xp, i32* %yp) {
; CHECK: tail call void bitcast (void (%Opaque_type*, %D2i*, i32*, i32*)* @A to void (%Opaque_type*, %S2i*, i32*, i32*)*)(%Opaque_type* sret %0, %S2i* %1, i32* %2, i32* %3)
; CHECK: ret void
+
+; Make sure we transfer the parameter attributes to the call site.
+; CHECK-LABEL: define void @B(%Opaque_type* sret
+; CHECK: %5 = bitcast
+; CHECK: tail call void @A(%Opaque_type* sret %0, %D2i* %5, i32* %2, i32* %3)
+; CHECK: ret void
+
diff --git a/test/Transforms/MergeFunc/inttoptr-address-space.ll b/test/Transforms/MergeFunc/inttoptr-address-space.ll
index 5f672debd91..86deb2c9495 100644
--- a/test/Transforms/MergeFunc/inttoptr-address-space.ll
+++ b/test/Transforms/MergeFunc/inttoptr-address-space.ll
@@ -21,7 +21,7 @@ define internal i8* @func35(%.qux.2585 addrspace(1)* nocapture %this) align 2 {
bb:
; CHECK-LABEL: @func35(
; CHECK: %[[V2:.+]] = bitcast %.qux.2585 addrspace(1)* %{{.*}} to %.qux.2496 addrspace(1)*
-; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* %[[V2]])
+; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* nocapture %[[V2]])
; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
%tmp = getelementptr inbounds %.qux.2585, %.qux.2585 addrspace(1)* %this, i32 0, i32 2
%tmp1 = load i8*, i8* addrspace(1)* %tmp, align 4
diff --git a/test/Transforms/MergeFunc/inttoptr.ll b/test/Transforms/MergeFunc/inttoptr.ll
index 0abbf6239a3..05ae766a6e3 100644
--- a/test/Transforms/MergeFunc/inttoptr.ll
+++ b/test/Transforms/MergeFunc/inttoptr.ll
@@ -48,7 +48,7 @@ define internal i8* @func35(%.qux.2585* nocapture %this) align 2 {
bb:
; CHECK-LABEL: @func35(
; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496*
-; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* %[[V2]])
+; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* nocapture %[[V2]])
; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
%tmp = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0, i32 2
%tmp1 = load i8*, i8** %tmp, align 4