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