xref: /llvm-project/llvm/test/CodeGen/X86/basic-block-sections-module1.ll (revision 6e83c0a1cbfdb0c0f13c282312c47c7945970f55)
1c13b046dSRahman Lavaee;; This file tests specifying the debug info filename in the basic block sections profile.
2c13b046dSRahman Lavaee;; Specify the right filename.
3c13b046dSRahman Lavaee; RUN: echo '!test M=/path/to/dir/test_filename' > %t1
4c13b046dSRahman Lavaee; RUN: echo '!!0' >> %t1
5c13b046dSRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=RIGHT-MODULE
6c13b046dSRahman Lavaee;; Specify no filename and verify that the profile is ingested.
7c13b046dSRahman Lavaee; RUN: echo '!test' > %t2
8c13b046dSRahman Lavaee; RUN: echo '!!0' >> %t2
9c13b046dSRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t2  | FileCheck %s -check-prefix=NO-MODULE
10c13b046dSRahman Lavaee;; Specify wrong filenames and verify that the profile is not ingested.
11c13b046dSRahman Lavaee; RUN: echo '!test M=test_filename' > %t3
12c13b046dSRahman Lavaee; RUN: echo '!!0' >> %t3
13c13b046dSRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t3  | FileCheck %s -check-prefix=WRONG-MODULE
14c13b046dSRahman Lavaee; RUN: echo '!test M=./path/to/dir/test_filename' > %t4
15c13b046dSRahman Lavaee; RUN: echo '!!0' >> %t4
16c13b046dSRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t4  | FileCheck %s -check-prefix=WRONG-MODULE
176ac71a01SRahman Lavaee;; Version 1 profile.
186ac71a01SRahman Lavaee;; Specify the right filename.
196ac71a01SRahman Lavaee; RUN: echo 'v1' > %t5
206ac71a01SRahman Lavaee; RUN: echo 'm /path/to/dir/test_filename' >> %t5
216ac71a01SRahman Lavaee; RUN: echo 'f test' >> %t5
226ac71a01SRahman Lavaee; RUN: echo 'c 0' >> %t5
236ac71a01SRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t5 | FileCheck %s -check-prefix=RIGHT-MODULE
246ac71a01SRahman Lavaee;; Specify no filename and verify that the profile is ingested.
256ac71a01SRahman Lavaee; RUN: echo 'v1' > %t6
266ac71a01SRahman Lavaee; RUN: echo 'f test' >> %t6
276ac71a01SRahman Lavaee; RUN: echo 'c 0' >> %t6
286ac71a01SRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t6  | FileCheck %s -check-prefix=NO-MODULE
296ac71a01SRahman Lavaee;; Specify wrong filenames and verify that the profile is not ingested.
306ac71a01SRahman Lavaee; RUN: echo 'v1' > %t7
316ac71a01SRahman Lavaee; RUN: echo 'm test_filename' >> %t7
326ac71a01SRahman Lavaee; RUN: echo 'f test' >> %t7
336ac71a01SRahman Lavaee; RUN: echo 'c 0' >> %t7
346ac71a01SRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t7  | FileCheck %s -check-prefix=WRONG-MODULE
356ac71a01SRahman Lavaee; RUN: echo 'v1' > %t8
366ac71a01SRahman Lavaee; RUN: echo 'm ./path/to/dir/test_filename' >> %t8
376ac71a01SRahman Lavaee; RUN: echo 'f test' >> %t8
386ac71a01SRahman Lavaee; RUN: echo 'c 0' >> %t8
396ac71a01SRahman Lavaee; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t8  | FileCheck %s -check-prefix=WRONG-MODULE
406ac71a01SRahman Lavaee
41c13b046dSRahman Lavaee
42c13b046dSRahman Lavaeedefine dso_local i32 @test(i32 noundef %0) #0 !dbg !10 {
43c13b046dSRahman Lavaee  %2 = alloca i32, align 4
44c13b046dSRahman Lavaee  %3 = alloca i32, align 4
45*6e83c0a1SNikita Popov  store i32 %0, ptr %3, align 4
46*6e83c0a1SNikita Popov  %4 = load i32, ptr %3, align 4
47c13b046dSRahman Lavaee  %5 = icmp slt i32 %4, 0
48c13b046dSRahman Lavaee  br i1 %5, label %6, label %7
49c13b046dSRahman Lavaee6:                                                ; preds = %1
50*6e83c0a1SNikita Popov  store i32 -1, ptr %2, align 4
51c13b046dSRahman Lavaee  ret i32 0
52c13b046dSRahman Lavaee7:
53c13b046dSRahman Lavaee  ret i32 1
54c13b046dSRahman Lavaee}
55c13b046dSRahman Lavaee
56c13b046dSRahman Lavaee!llvm.dbg.cu = !{!0}
57c13b046dSRahman Lavaee!llvm.module.flags = !{!2, !3}
58c13b046dSRahman Lavaee
59c13b046dSRahman Lavaee!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
60c13b046dSRahman Lavaee!1 = !DIFile(filename: "/path/to/dir/test_filename", directory: "/path/to/dir")
61c13b046dSRahman Lavaee!2 = !{i32 7, !"Dwarf Version", i32 5}
62c13b046dSRahman Lavaee!3 = !{i32 2, !"Debug Info Version", i32 3}
63c13b046dSRahman Lavaee!10 = distinct !DISubprogram(name: "test", scope: !1, unit: !0)
64c13b046dSRahman Lavaee
65c13b046dSRahman Lavaee;; Check that the split section is created when using the correct module name, or no module name.
66c13b046dSRahman Lavaee;
67c13b046dSRahman Lavaee; RIGHT-MODULE: .section        .text.split.test,"ax",@progbits
68c13b046dSRahman Lavaee; NO-MODULE: .section        .text.split.test,"ax",@progbits
69c13b046dSRahman Lavaee; WRONG-MODULE-NOT: .section    .text.split.test,"ax",@progbits
70