File: inline-landing-pad.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (73 lines) | stat: -rw-r--r-- 4,386 bytes parent folder | download | duplicates (3)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -mtriple=x86_64-unknown-unknown -S -passes=inline | FileCheck %s
;; Test that when we inline an invoked function, when we replace an inlined
;; "resume" instruction with a branch to the landing pad block, we also transfer
;; the resume's source location to the branch.

define void @widget() personality ptr null !dbg !11 {
; CHECK-LABEL: define void @widget(
; CHECK-SAME: ) personality ptr null !dbg [[DBG4:![0-9]+]] {
; CHECK-NEXT:  [[BAZ_EXIT:.*]]:
; CHECK-NEXT:    br label %[[BB2_BODY:.*]], !dbg [[DBG7:![0-9]+]]
; CHECK:       [[BAZ_EXIT1:.*:]]
; CHECK-NEXT:    br label %[[BB1:.*]]
; CHECK:       [[BB1]]:
; CHECK-NEXT:    ret void
; CHECK:       [[BB2:.*]]:
; CHECK-NEXT:    [[LANDINGPAD:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT:            cleanup
; CHECK-NEXT:    br label %[[BB2_BODY]]
; CHECK:       [[BB2_BODY]]:
; CHECK-NEXT:    [[EH_LPAD_BODY:%.*]] = phi { ptr, i32 } [ [[LANDINGPAD]], %[[BB2]] ], [ zeroinitializer, %[[BAZ_EXIT]] ]
; CHECK-NEXT:    br label %[[BB1]]
;
bb:
  %invoke = invoke i32 @baz(ptr null, ptr null)
  to label %bb1 unwind label %bb2, !dbg !4

bb1:                                              ; preds = %bb2, %bb
  ret void

bb2:                                              ; preds = %bb
  %landingpad = landingpad { ptr, i32 }
  cleanup
  br label %bb1
}

define i32 @baz(ptr %arg, ptr %arg1) personality ptr null !dbg !14 {
; CHECK-LABEL: define i32 @baz(
; CHECK-SAME: ptr [[ARG:%.*]], ptr [[ARG1:%.*]]) personality ptr null !dbg [[DBG8:![0-9]+]] {
; CHECK-NEXT:  [[BB:.*:]]
; CHECK-NEXT:    resume { ptr, i32 } zeroinitializer, !dbg [[DBG10:![0-9]+]]
;
bb:
  resume { ptr, i32 } zeroinitializer, !dbg !15
}

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

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 20.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp")
!2 = !{}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !DILocation(line: 99, column: 17, scope: !11)
!6 = !DIFile(filename: "inline-landing-pad.cpp", directory: "/tmp")
!11 = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: !6, file: !6, line: 87, type: !12, scopeLine: 88, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
!12 = distinct !DISubroutineType(types: !13)
!13 = !{null}
!14 = distinct !DISubprogram(name: "baz", linkageName: "baz", scope: !6, file: !6, line: 7, type: !12, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
!15 = !DILocation(line: 9, column: 7, scope: !14)
!16 = distinct !DISubroutineType(types: !13)
;.
; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: [[META2:![0-9]+]], globals: [[META2]], imports: [[META2]], splitDebugInlining: false, nameTableKind: None)
; CHECK: [[META1]] = !DIFile(filename: "inline-landing-pad.cpp", directory: {{.*}})
; CHECK: [[META2]] = !{}
; CHECK: [[DBG4]] = distinct !DISubprogram(name: "widget", linkageName: "widget", scope: [[META1]], file: [[META1]], line: 87, type: [[META5:![0-9]+]], scopeLine: 88, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]])
; CHECK: [[META5]] = distinct !DISubroutineType(types: [[META6:![0-9]+]])
; CHECK: [[META6]] = !{null}
; CHECK: [[DBG7]] = !DILocation(line: 9, column: 7, scope: [[DBG8]], inlinedAt: [[META9:![0-9]+]])
; CHECK: [[DBG8]] = distinct !DISubprogram(name: "baz", linkageName: "baz", scope: [[META1]], file: [[META1]], line: 7, type: [[META5]], scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META2]])
; CHECK: [[META9]] = distinct !DILocation(line: 99, column: 17, scope: [[DBG4]])
; CHECK: [[DBG10]] = !DILocation(line: 9, column: 7, scope: [[DBG8]])
;.