File: peel-last-iteration-debug.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,235,796 kB
  • sloc: cpp: 7,617,614; ansic: 1,433,901; asm: 1,058,726; python: 252,096; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 10,032; ml: 5,111; perl: 4,720; awk: 3,523; makefile: 3,401; javascript: 2,272; xml: 892; fortran: 770
file content (76 lines) | stat: -rw-r--r-- 4,051 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -p loop-unroll -unroll-full-max-count=0 -S %s | FileCheck %s

declare void @foo(i32)

define void @test_dbg_value_in_exit_block() {
; CHECK-LABEL: define void @test_dbg_value_in_exit_block() {
; CHECK-NEXT:  [[ENTRY:.*]]:
; CHECK-NEXT:    br label %[[LOOP:.*]]
; CHECK:       [[LOOP]]:
; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[INC:%.*]], %[[LOOP]] ]
; CHECK-NEXT:    call void @foo(i32 0)
; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[IV]], 1
; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 20
; CHECK-NEXT:    br i1 [[EXITCOND]], label %[[LOOP]], label %[[EXIT_PEEL_BEGIN:.*]], !llvm.loop [[LOOP4:![0-9]+]]
; CHECK:       [[EXIT_PEEL_BEGIN]]:
; CHECK-NEXT:    [[TMP0:%.*]] = phi i32 [ [[INC]], %[[LOOP]] ]
; CHECK-NEXT:      #dbg_value(float poison, [[META6:![0-9]+]], !DIExpression(), [[META11:![0-9]+]])
; CHECK-NEXT:    br label %[[LOOP_PEEL:.*]]
; CHECK:       [[LOOP_PEEL]]:
; CHECK-NEXT:    [[CMP2_PEEL:%.*]] = icmp eq i32 [[TMP0]], 20
; CHECK-NEXT:    [[SEL_PEEL:%.*]] = select i1 [[CMP2_PEEL]], i32 1, i32 0
; CHECK-NEXT:    call void @foo(i32 [[SEL_PEEL]])
; CHECK-NEXT:    [[INC_PEEL:%.*]] = add i32 [[TMP0]], 1
; CHECK-NEXT:    [[EXITCOND_PEEL:%.*]] = icmp ne i32 [[INC_PEEL]], 21
; CHECK-NEXT:    br i1 [[EXITCOND_PEEL]], label %[[EXIT_PEEL_NEXT:.*]], label %[[EXIT_PEEL_NEXT]]
; CHECK:       [[EXIT_PEEL_NEXT]]:
; CHECK-NEXT:    br label %[[LOOP_PEEL_NEXT:.*]]
; CHECK:       [[LOOP_PEEL_NEXT]]:
; CHECK-NEXT:    br label %[[EXIT:.*]]
; CHECK:       [[EXIT]]:
; CHECK-NEXT:    ret void
;
entry:
  br label %loop

loop:
  %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
  %cmp2 = icmp eq i32 %iv, 20
  %sel = select i1 %cmp2, i32 1, i32 0
  call void @foo(i32 %sel)
  %inc = add i32 %iv, 1
  %exitcond = icmp ne i32 %inc, 21
  br i1 %exitcond, label %loop, label %exit

exit:
    #dbg_value(float poison, !4, !DIExpression(), !9)
  ret void
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}

!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 21.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "repro.c", directory: "/", checksumkind: CSK_MD5, checksum: "3a182b2d218eb10b64164b06427cef3c")
!2 = !{}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !DILocalVariable(name: "m_2", scope: !5, file: !1, line: 4, type: !8)
!5 = distinct !DISubprogram(name: "test_dbg_value_in_exit_block", scope: !1, file: !1, line: 3, type: !6, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
!6 = !DISubroutineType(types: !7)
!7 = !{null}
!8 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
!9 = !DILocation(line: 0, scope: !5)
;.
; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
; CHECK: [[META1]] = !DIFile(filename: "{{.*}}repro.c", directory: {{.*}})
; CHECK: [[META2]] = !{}
; CHECK: [[LOOP4]] = distinct !{[[LOOP4]], [[META5:![0-9]+]]}
; CHECK: [[META5]] = !{!"llvm.loop.peeled.count", i32 1}
; CHECK: [[META6]] = !DILocalVariable(name: "m_2", scope: [[META7:![0-9]+]], file: [[META1]], line: 4, type: [[META10:![0-9]+]])
; CHECK: [[META7]] = distinct !DISubprogram(name: "test_dbg_value_in_exit_block", scope: [[META1]], file: [[META1]], line: 3, type: [[META8:![0-9]+]], scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]])
; CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
; CHECK: [[META9]] = !{null}
; CHECK: [[META10]] = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
; CHECK: [[META11]] = !DILocation(line: 0, scope: [[META7]])
;.