blob: 4517e448018ba531fff58e68bdbf1e8681904934 [file] [log] [blame]
Julien Lerougebe4fe322014-04-15 18:06:46 +00001; RUN: opt -S -inline < %s | FileCheck %s
Chandler Carruth625038d2016-12-27 07:18:43 +00002; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s
Julien Lerougebe4fe322014-04-15 18:06:46 +00003
4; By inlining foo, an alloca is created in main to hold the byval argument, so
5; a lifetime marker should be generated as well by default.
6
7%struct.foo = type { i32, [16 x i32] }
8
9@gFoo = global %struct.foo zeroinitializer, align 8
10
11define i32 @foo(%struct.foo* byval align 8 %f, i32 %a) {
12entry:
David Blaikie79e6c742015-02-27 19:29:02 +000013 %a1 = getelementptr inbounds %struct.foo, %struct.foo* %f, i32 0, i32 1
14 %arrayidx = getelementptr inbounds [16 x i32], [16 x i32]* %a1, i32 0, i32 %a
David Blaikiea79ac142015-02-27 21:17:42 +000015 %tmp2 = load i32, i32* %arrayidx, align 1
Julien Lerougebe4fe322014-04-15 18:06:46 +000016 ret i32 %tmp2
17}
18
19define i32 @main(i32 %argc, i8** %argv) {
20; CHECK-LABEL: @main
21; CHECK: llvm.lifetime.start
22; CHECK: memcpy
23entry:
24 %call = call i32 @foo(%struct.foo* byval align 8 @gFoo, i32 %argc)
25 ret i32 %call
26}