xref: /llvm-project/llvm/test/DebugInfo/X86/loop-align-debug.ll (revision b468ed494acde4d1cc496a436ab9109660db5b80)
1; RUN: llc %s --filetype=obj -o %t
2; RUN: llvm-objdump -d %t | FileCheck %s --check-prefixes=OBJ
3; RUN: llvm-dwarfdump --debug-line %t | FileCheck %s --check-prefixes=DBG
4; RUN: llc %s -o - | FileCheck %s --check-prefixes=ASM
5
6; OBJ: 1:{{.*}}nop
7
8;; prologue_end goes on start-of-loop, the call to @g.
9;;     Address            Line   Column File   ISA Discriminator OpIndex Flags
10; DBG: 0x0000000000000000      3      0      0   0             0       0  is_stmt
11; DBG: 0x0000000000000001      0      0      0   0             0       0
12; DBG: 0x0000000000000010      5      0      0   0             0       0  is_stmt prologue_end
13; DBG: 0x0000000000000017      5      0      0   0             0       0  is_stmt end_sequence
14
15; ASM:      .loc    0 0 0 is_stmt 0
16; ASM-NEXT: .L{{.*}}:
17; ASM-NEXT: .p2align        4
18
19;; $ cat test.cpp
20;; void g();
21;; void f() {
22;;   [[clang::code_align(16)]]
23;;   while (1) { g(); }
24;; }
25
26target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
27target triple = "x86_64-unknown-linux-gnu"
28
29define dso_local void @f() local_unnamed_addr !dbg !9 {
30entry:
31  br label %while.body, !dbg !12
32
33while.body:                                       ; preds = %entry, %while.body
34  tail call void @g(), !dbg !12
35  br label %while.body, !dbg !12, !llvm.loop !13
36}
37
38declare !dbg !16 void @g() local_unnamed_addr
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!2, !3}
42!llvm.ident = !{!8}
43
44!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 19.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)
45!1 = !DIFile(filename: "test.cpp", directory: "/")
46!2 = !{i32 7, !"Dwarf Version", i32 5}
47!3 = !{i32 2, !"Debug Info Version", i32 3}
48!8 = !{!"clang version 19.0.0git"}
49!9 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !10, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
50!10 = !DISubroutineType(types: !11)
51!11 = !{}
52!12 = !DILocation(line: 5, scope: !9)
53!13 = distinct !{!13, !12, !12, !14, !15}
54!14 = !{!"llvm.loop.mustprogress"}
55!15 = !{!"llvm.loop.align", i32 16}
56!16 = !DISubprogram(name: "g", scope: !1, file: !1, line: 2, type: !10, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
57