aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/Inline/byval.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/Inline/byval.ll b/test/Transforms/Inline/byval.ll
index 08219fc..e601faf 100644
--- a/test/Transforms/Inline/byval.ll
+++ b/test/Transforms/Inline/byval.ll
@@ -81,3 +81,26 @@ entry:
; CHECK: call void @g3(%struct.ss* %S1)
; CHECK: ret void
}
+
+
+; Inlining a byval struct should NOT cause an explicit copy
+; into an alloca if the function is readonly, but should increase an alloca's
+; alignment to satisfy an explicit alignment request.
+
+define internal i32 @f4(%struct.ss* byval align 64 %b) nounwind readonly {
+ call void @g3(%struct.ss* %b)
+ ret i32 4
+}
+
+define i32 @test4() nounwind {
+entry:
+ %S = alloca %struct.ss, align 2 ; <%struct.ss*> [#uses=4]
+ %X = call i32 @f4( %struct.ss* byval align 64 %S ) nounwind
+ ret i32 %X
+; CHECK: @test4()
+; CHECK: %S = alloca %struct.ss, align 64
+; CHECK-NOT: call void @llvm.memcpy
+; CHECK: call void @g3
+; CHECK: ret i32 4
+}
+