xref: /llvm-project/llvm/test/CodeGen/X86/basic-block-sections-clusters-error.ll (revision e1616ef9d742ebcc226451c4ca5ec2204c460840)
1;; BB cluster sections error handling
2;; Error handling for version 0:
3; RUN: echo '!dummy1' > %t1
4; RUN: echo '!!1 4' >> %t1
5; RUN: echo '!!1' >> %t1
6; RUN: not --crash llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR1
7; CHECK-ERROR1: LLVM ERROR: invalid profile {{.*}} at line 3: duplicate basic block id found '1'
8; RUN: echo '!dummy1' > %t3
9; RUN: echo '!!-1' >> %t3
10; RUN: not --crash llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t3 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR3
11; CHECK-ERROR3: LLVM ERROR: invalid profile {{.*}} at line 2: unsigned integer expected: '-1'
12; RUN: echo '!dummy1 /path/to/filename' > %t4
13; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t4 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR4
14; CHECK-ERROR4: LLVM ERROR: invalid profile {{.*}} at line 1: unknown string found: '/path/to/filename'
15; RUN: echo '!dummy2 M=test_dir/test_file' > %t5
16; RUN: echo '!dummy2 M=test_dir/test_file' >> %t5
17; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t5 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR5
18; CHECK-ERROR5: LLVM ERROR: invalid profile {{.*}} at line 2: duplicate profile for function 'dummy2'
19; RUN: echo '!dummy1 M=' > %t6
20; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t6 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR6
21; CHECK-ERROR6: LLVM ERROR: invalid profile {{.*}} at line 1: empty module name specifier
22;;
23;; Error handling for version 1:
24; RUN: echo 'v2' > %t7
25; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t7 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR7
26; CHECK-ERROR7: LLVM ERROR: invalid profile {{.*}} at line 1: invalid profile version: 2
27; RUN: echo 'v1' > %t8
28; RUN: echo '!dummy1' >> %t8
29; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t8 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR8
30; CHECK-ERROR8: LLVM ERROR: invalid profile {{.*}} at line 2: invalid specifier: '!'
31; RUN: echo 'v1' > %t9
32; RUN: echo 'm dummy1/module1 dummy1/module2' >> %t9
33; RUN: echo 'f dummy1' >> %t9
34; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t9 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR9
35; CHECK-ERROR9: LLVM ERROR: invalid profile {{.*}} at line 2: invalid module name value: 'dummy1/module1 dummy1/module2'
36;;
37;; Error handling for version 1, cloning paths.
38; RUN: echo 'v1' > %t10
39; RUN: echo 'f dummy1' >> %t10
40; RUN: echo 'c 0 1.1.1' >> %t10
41; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t10 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR10
42; CHECK-ERROR10: LLVM ERROR: invalid profile {{.*}} at line 3: unable to parse basic block id: '1.1.1'
43; RUN: echo 'v1' > %t11
44; RUN: echo 'f dummy1' >> %t11
45; RUN: echo 'c 0 1.a' >> %t11
46; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t11 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR11
47; CHECK-ERROR11: LLVM ERROR: invalid profile {{.*}} at line 3: unable to parse clone id: 'a'
48; RUN: echo 'v1' > %t12
49; RUN: echo 'f dummy1' >> %t12
50; RUN: echo 'c 0 1' >> %t12
51; RUN: echo 'p 1 2.1' >> %t12
52; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t12 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR12
53; CHECK-ERROR12: LLVM ERROR: invalid profile {{.*}} at line 4: unsigned integer expected: '2.1'
54; RUN: echo 'v1' > %t13
55; RUN: echo 'f dummy1' >> %t13
56; RUN: echo 'c 0 1' >> %t13
57; RUN: echo 'p 1 2 3 2' >> %t13
58; RUN: not --crash llc < %s -O0 -mtriple=x86_64 -function-sections -basic-block-sections=%t13 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR13
59; CHECK-ERROR13: LLVM ERROR: invalid profile {{.*}} at line 4: duplicate cloned block in path: '2'
60
61define i32 @dummy1(i32 %x, i32 %y, i32 %z) {
62  entry:
63    %tmp = mul i32 %x, %y
64    %tmp2 = add i32 %tmp, %z
65    ret i32 %tmp2
66}
67
68define i32 @dummy2(i32 %x, i32 %y, i32 %z) !dbg !4 {
69  entry:
70    %tmp = mul i32 %x, %y
71    %tmp2 = add i32 %tmp, %z
72    ret i32 %tmp2
73}
74
75!llvm.dbg.cu = !{!0}
76!llvm.module.flags = !{!2, !3}
77
78!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
79!1 = !DIFile(filename: "test_dir/test_file", directory: "test_dir")
80!2 = !{i32 7, !"Dwarf Version", i32 5}
81!3 = !{i32 2, !"Debug Info Version", i32 3}
82!4 = distinct !DISubprogram(name: "dummy1", scope: !1, unit: !0)
83
84