xref: /llvm-project/llvm/test/CodeGen/X86/basic-block-sections-module2.ll (revision 6e83c0a1cbfdb0c0f13c282312c47c7945970f55)
1;; This file tests various ways of specifying the debug info filename in the basic block sections profile.
2;; Specifying correct filenames.
3; RUN: echo '!test1 M=./test_dirname1/test_filename1' > %t1
4; RUN: echo '!!0' >> %t1
5; RUN: echo '!test2 M=.//test_filename2' >> %t1
6; RUN: echo '!!0' >> %t1
7; RUN: echo '!test3 M=test_filename3' >> %t1
8; RUN: echo '!!0' >> %t1
9; RUN: echo '!test4 M=/test_dirname4/test_filename4' >> %t1
10; RUN: echo '!!0' >> %t1
11; RUN: echo '!test5' >> %t1
12; RUN: echo '!!0' >> %t1
13; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t1  | FileCheck %s -check-prefix=RIGHT-MODULE
14;; Specifying wrong filenames.
15; RUN: echo '!test1 M=/test_dirname/test_filename1' > %t2
16; RUN: echo '!!0' >> %t2
17; RUN: echo '!test1 M=../test_filename1' >> %t2
18; RUN: echo '!!0' >> %t2
19; RUN: echo '!test2 M=.test_filename2' >> %t2
20; RUN: echo '!!0' >> %t2
21; RUN: echo '!test4 M=./test_dirname4/test_filename4' >> %t2
22; RUN: echo '!!0' >> %t2
23; RUN: echo '!test5 M=any_filename' >> %t1
24; RUN: echo '!!0' >> %t1
25; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t2  | FileCheck %s -check-prefix=WRONG-MODULE
26
27define dso_local i32 @test1(i32 noundef %0) #0 !dbg !10 {
28  %2 = alloca i32, align 4
29  %3 = alloca i32, align 4
30  store i32 %0, ptr %3, align 4
31  %4 = load i32, ptr %3, align 4
32  %5 = icmp slt i32 %4, 0
33  br i1 %5, label %6, label %7
346:                                                ; preds = %1
35  store i32 -1, ptr %2, align 4
36  ret i32 0
377:
38  ret i32 1
39}
40
41define dso_local i32 @test2(i32 noundef %0) #0 !dbg !11 {
42  %2 = alloca i32, align 4
43  %3 = alloca i32, align 4
44  store i32 %0, ptr %3, align 4
45  %4 = load i32, ptr %3, align 4
46  %5 = icmp slt i32 %4, 0
47  br i1 %5, label %6, label %7
486:                                                ; preds = %1
49  store i32 -1, ptr %2, align 4
50  ret i32 0
517:
52  ret i32 1
53}
54
55define dso_local i32 @test3(i32 noundef %0) #0 !dbg !12 {
56  %2 = alloca i32, align 4
57  %3 = alloca i32, align 4
58  store i32 %0, ptr %3, align 4
59  %4 = load i32, ptr %3, align 4
60  %5 = icmp slt i32 %4, 0
61  br i1 %5, label %6, label %7
626:                                                ; preds = %1
63  store i32 -1, ptr %2, align 4
64  ret i32 0
657:
66  ret i32 1
67}
68
69define dso_local i32 @test4(i32 noundef %0) #0 !dbg !13 {
70  %2 = alloca i32, align 4
71  %3 = alloca i32, align 4
72  store i32 %0, ptr %3, align 4
73  %4 = load i32, ptr %3, align 4
74  %5 = icmp slt i32 %4, 0
75  br i1 %5, label %6, label %7
766:                                                ; preds = %1
77  store i32 -1, ptr %2, align 4
78  ret i32 0
797:
80  ret i32 1
81}
82
83define dso_local i32 @test5(i32 noundef %0) #0 {
84  %2 = alloca i32, align 4
85  %3 = alloca i32, align 4
86  store i32 %0, ptr %3, align 4
87  %4 = load i32, ptr %3, align 4
88  %5 = icmp slt i32 %4, 0
89  br i1 %5, label %6, label %7
906:                                                ; preds = %1
91  store i32 -1, ptr %2, align 4
92  ret i32 0
937:
94  ret i32 1
95}
96
97!llvm.dbg.cu = !{!0, !1, !2, !3}
98!llvm.module.flags = !{!8, !9}
99
100!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !4)
101!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !5)
102!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6)
103!3 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7)
104!4 = !DIFile(filename: "test_dirname1/test_filename1", directory: "test_dirname1")
105!5 = !DIFile(filename: "test_filename2", directory: "")
106!6 = !DIFile(filename: "./test_filename3", directory: ".")
107!7 = !DIFile(filename: "/test_dirname4/test_filename4", directory: "/test_dirname4")
108!8 = !{i32 7, !"Dwarf Version", i32 5}
109!9 = !{i32 2, !"Debug Info Version", i32 3}
110!10 = distinct !DISubprogram(name: "test1", scope: !4, unit: !0)
111!11 = distinct !DISubprogram(name: "test2", scope: !5, unit: !1)
112!12 = distinct !DISubprogram(name: "test3", scope: !6, unit: !2)
113!13 = distinct !DISubprogram(name: "test4", scope: !7, unit: !3)
114
115;; Check that the split section is created when using the correct module name, or no module name.
116;
117; RIGHT-MODULE: .section        .text.split.test1,"ax",@progbits
118; RIGHT-MODULE: .section        .text.split.test2,"ax",@progbits
119; RIGHT-MODULE: .section        .text.split.test3,"ax",@progbits
120; RIGHT-MODULE: .section        .text.split.test4,"ax",@progbits
121; RIGHT-MODULE: .section        .text.split.test5,"ax",@progbits
122; WRONG-MODULE-NOT: .section        .text.split.test{{[1-5]+}},"ax",@progbits
123