1; RUN: llvm-split -o %t_s3_ %s -j 3 -mtriple amdgcn-amd-amdhsa -amdgpu-module-splitting-max-depth=8 2; RUN: llvm-dis -o - %t_s3_0 | FileCheck --check-prefix=SPLIT3-CHECK0 --implicit-check-not=define %s 3; RUN: llvm-dis -o - %t_s3_1 | FileCheck --check-prefix=SPLIT3-CHECK1 --implicit-check-not=define %s 4; RUN: llvm-dis -o - %t_s3_2 | FileCheck --check-prefix=SPLIT3-CHECK2 --implicit-check-not=define %s 5 6; RUN: llvm-split -o %t_s5_ %s -j 5 -mtriple amdgcn-amd-amdhsa -amdgpu-module-splitting-max-depth=8 7; RUN: llvm-dis -o - %t_s5_0 | FileCheck --check-prefix=SPLIT5-CHECK0 --implicit-check-not=define %s 8; RUN: llvm-dis -o - %t_s5_1 | FileCheck --check-prefix=SPLIT5-CHECK1 --implicit-check-not=define %s 9; RUN: llvm-dis -o - %t_s5_2 | FileCheck --check-prefix=SPLIT5-CHECK2 --implicit-check-not=define %s 10; RUN: llvm-dis -o - %t_s5_3 | FileCheck --check-prefix=SPLIT5-CHECK3 --implicit-check-not=define %s 11; RUN: llvm-dis -o - %t_s5_4 | FileCheck --check-prefix=SPLIT5-CHECK4 --implicit-check-not=define %s 12 13; Test the specifics of the search algorithm. 14; This test will change depending on new heuristics we add or remove. 15 16; -------------------------------------------- 17 18; SPLIT3-CHECK0: define amdgpu_kernel void @A() 19; SPLIT3-CHECK0: define internal void @HelperA() 20; SPLIT3-CHECK0: define amdgpu_kernel void @B() 21; SPLIT3-CHECK0: define internal void @HelperB() 22 23; SPLIT3-CHECK1: define amdgpu_kernel void @C() 24; SPLIT3-CHECK1: define internal void @HelperC() 25 26; SPLIT3-CHECK2: define internal void @HelperA() 27; SPLIT3-CHECK2: define internal void @HelperB() 28; SPLIT3-CHECK2: define internal void @HelperC() 29; SPLIT3-CHECK2: define amdgpu_kernel void @AB() 30; SPLIT3-CHECK2: define amdgpu_kernel void @BC() 31; SPLIT3-CHECK2: define amdgpu_kernel void @ABC() 32 33; -------------------------------------------- 34 35; SPLIT5-CHECK0: define amdgpu_kernel void @A() 36; SPLIT5-CHECK0: define internal void @HelperA() 37 38; SPLIT5-CHECK1: define amdgpu_kernel void @B() 39; SPLIT5-CHECK1: define internal void @HelperB() 40 41; SPLIT5-CHECK2: define internal void @HelperB() 42; SPLIT5-CHECK2: define internal void @HelperC() 43; SPLIT5-CHECK2: define amdgpu_kernel void @BC 44 45; SPLIT5-CHECK3: define amdgpu_kernel void @C() 46; SPLIT5-CHECK3: define internal void @HelperC() 47 48; SPLIT5-CHECK4: define internal void @HelperA() 49; SPLIT5-CHECK4: define internal void @HelperB() 50; SPLIT5-CHECK4: define internal void @HelperC() 51; SPLIT5-CHECK4: define amdgpu_kernel void @AB() 52; SPLIT5-CHECK4: define amdgpu_kernel void @ABC() 53 54define amdgpu_kernel void @A() { 55 store volatile i64 42, ptr null 56 store volatile i64 42, ptr null 57 store volatile i64 42, ptr null 58 store volatile i64 42, ptr null 59 store volatile i64 42, ptr null 60 call void @HelperA() 61 ret void 62} 63 64define internal void @HelperA() { 65 store volatile i32 42, ptr null 66 store volatile i32 42, ptr null 67 ret void 68} 69 70define amdgpu_kernel void @B() { 71 store volatile i64 42, ptr null 72 store volatile i64 42, ptr null 73 store volatile i64 42, ptr null 74 store volatile i64 42, ptr null 75 call void @HelperB() 76 ret void 77} 78 79define internal void @HelperB() { 80 store volatile i32 42, ptr null 81 store volatile i32 42, ptr null 82 store volatile i32 42, ptr null 83 ret void 84} 85 86define amdgpu_kernel void @C() { 87 store volatile i64 42, ptr null 88 store volatile i64 42, ptr null 89 store volatile i64 42, ptr null 90 store volatile i64 42, ptr null 91 store volatile i64 42, ptr null 92 store volatile i64 42, ptr null 93 store volatile i64 42, ptr null 94 store volatile i64 42, ptr null 95 call void @HelperC() 96 ret void 97} 98 99define internal void @HelperC() { 100 store volatile i32 42, ptr null 101 ret void 102} 103 104define amdgpu_kernel void @AB() { 105 store volatile i32 42, ptr null 106 call void @HelperA() 107 call void @HelperB() 108 ret void 109} 110 111define amdgpu_kernel void @BC() { 112 store volatile i32 42, ptr null 113 store volatile i32 42, ptr null 114 call void @HelperB() 115 call void @HelperC() 116 ret void 117} 118 119define amdgpu_kernel void @ABC() { 120 call void @HelperA() 121 call void @HelperB() 122 call void @HelperC() 123 ret void 124} 125