1; RUN: llvm-split -preserve-locals -o %t %s 2; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s 3; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s 4 5; The local_var and local_func must not be separated. 6; CHECK0: @local_var 7; CHECK0: define internal fastcc void @local_func 8; The main and a must not be separated. 9; The main and local_func must not be together. 10; CHECK1: @a 11; CHECK1: define i32 @main 12; CHECK1: declare fastcc void @local_func 13 14@a = internal global i32 0, align 4 15@global_storage = common global i32 0, align 4 16@local_var = internal global i32 0, align 4 17 18; Function Attrs: nounwind 19define i32 @main(i32 %x) { 20entry: 21 %call = call fastcc i32 @foo(i32 %x, i32* nonnull @a) 22 %call1 = call fastcc i32 @baz(i32 %x) 23 %add = add nsw i32 %call, %call1 24 ret i32 %add 25} 26 27; Function Attrs: nounwind 28define fastcc i32 @bar(i32 %b) { 29entry: 30 %call = call fastcc i32 @baz(i32 %b) 31 ret i32 %call 32} 33 34; Function Attrs: nounwind 35define fastcc i32 @baz(i32 %x) { 36entry: 37 store i32 %x, i32* @global_storage, align 4 38 %shl = shl i32 %x, %x 39 ret i32 %shl 40} 41 42; Function Attrs: noinline nounwind 43define fastcc i32 @foo(i32 %a, i32* nocapture %b) { 44entry: 45 call fastcc void @local_func() 46 %call = call fastcc i32 @bar(i32 %a) 47 %0 = load i32, i32* @global_storage, align 4 48 %call1 = call fastcc i32 @baz(i32 %0) 49 %add = add nsw i32 %call, %call1 50 store i32 %add, i32* %b, align 4 51 %call.i = call fastcc i32 @baz(i32 %add) #2 52 %add.i = add nsw i32 %call.i, 2 53 %1 = load volatile i32, i32* @local_var, align 4 54 %add3 = add nsw i32 %add.i, %1 55 ret i32 %add3 56} 57 58; Function Attrs: noinline nounwind 59define internal fastcc void @local_func() section ".text" { 60entry: 61 %0 = load i32, i32* @global_storage, align 4 62 %call = call fastcc i32 @foo(i32 %0, i32* null) 63 store volatile i32 %call, i32* @local_var, align 4 64 ret void 65} 66