xref: /llvm-project/llvm/test/CodeGen/X86/basic-block-sections-module1.ll (revision 6e83c0a1cbfdb0c0f13c282312c47c7945970f55)
1;; This file tests specifying the debug info filename in the basic block sections profile.
2;; Specify the right filename.
3; RUN: echo '!test M=/path/to/dir/test_filename' > %t1
4; RUN: echo '!!0' >> %t1
5; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=RIGHT-MODULE
6;; Specify no filename and verify that the profile is ingested.
7; RUN: echo '!test' > %t2
8; RUN: echo '!!0' >> %t2
9; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t2  | FileCheck %s -check-prefix=NO-MODULE
10;; Specify wrong filenames and verify that the profile is not ingested.
11; RUN: echo '!test M=test_filename' > %t3
12; RUN: echo '!!0' >> %t3
13; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t3  | FileCheck %s -check-prefix=WRONG-MODULE
14; RUN: echo '!test M=./path/to/dir/test_filename' > %t4
15; RUN: echo '!!0' >> %t4
16; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t4  | FileCheck %s -check-prefix=WRONG-MODULE
17;; Version 1 profile.
18;; Specify the right filename.
19; RUN: echo 'v1' > %t5
20; RUN: echo 'm /path/to/dir/test_filename' >> %t5
21; RUN: echo 'f test' >> %t5
22; RUN: echo 'c 0' >> %t5
23; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t5 | FileCheck %s -check-prefix=RIGHT-MODULE
24;; Specify no filename and verify that the profile is ingested.
25; RUN: echo 'v1' > %t6
26; RUN: echo 'f test' >> %t6
27; RUN: echo 'c 0' >> %t6
28; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t6  | FileCheck %s -check-prefix=NO-MODULE
29;; Specify wrong filenames and verify that the profile is not ingested.
30; RUN: echo 'v1' > %t7
31; RUN: echo 'm test_filename' >> %t7
32; RUN: echo 'f test' >> %t7
33; RUN: echo 'c 0' >> %t7
34; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t7  | FileCheck %s -check-prefix=WRONG-MODULE
35; RUN: echo 'v1' > %t8
36; RUN: echo 'm ./path/to/dir/test_filename' >> %t8
37; RUN: echo 'f test' >> %t8
38; RUN: echo 'c 0' >> %t8
39; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t8  | FileCheck %s -check-prefix=WRONG-MODULE
40
41
42define dso_local i32 @test(i32 noundef %0) #0 !dbg !10 {
43  %2 = alloca i32, align 4
44  %3 = alloca i32, align 4
45  store i32 %0, ptr %3, align 4
46  %4 = load i32, ptr %3, align 4
47  %5 = icmp slt i32 %4, 0
48  br i1 %5, label %6, label %7
496:                                                ; preds = %1
50  store i32 -1, ptr %2, align 4
51  ret i32 0
527:
53  ret i32 1
54}
55
56!llvm.dbg.cu = !{!0}
57!llvm.module.flags = !{!2, !3}
58
59!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
60!1 = !DIFile(filename: "/path/to/dir/test_filename", directory: "/path/to/dir")
61!2 = !{i32 7, !"Dwarf Version", i32 5}
62!3 = !{i32 2, !"Debug Info Version", i32 3}
63!10 = distinct !DISubprogram(name: "test", scope: !1, unit: !0)
64
65;; Check that the split section is created when using the correct module name, or no module name.
66;
67; RIGHT-MODULE: .section        .text.split.test,"ax",@progbits
68; NO-MODULE: .section        .text.split.test,"ax",@progbits
69; WRONG-MODULE-NOT: .section    .text.split.test,"ax",@progbits
70