diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-20 08:10:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-20 08:10:40 +0000 |
commit | 0b66f63a26387f5c0360a4324fc3c31e0599a6e0 (patch) | |
tree | 01e7a70c8c98fdb28f30a076318f0c111b36ceeb /test | |
parent | e7ae705c32906979a527926864345016e76867b9 (diff) | |
download | external_llvm-0b66f63a26387f5c0360a4324fc3c31e0599a6e0.zip external_llvm-0b66f63a26387f5c0360a4324fc3c31e0599a6e0.tar.gz external_llvm-0b66f63a26387f5c0360a4324fc3c31e0599a6e0.tar.bz2 |
when eliding a byval copy due to inlining a readonly function, we have
to make sure that the reused alloca has sufficient alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122236 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/Inline/byval.ll | 23 |
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 +} + |