File: crash.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (149 lines) | stat: -rw-r--r-- 5,011 bytes parent folder | download | duplicates (2)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC

%S = type { ptr }

; Inlining should nuke the invoke (and any inlined calls) here even with
; argument promotion running along with it.
define void @zot() personality ptr @wibble {
; TUNIT: Function Attrs: nofree norecurse noreturn nosync nounwind willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@zot
; TUNIT-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble {
; TUNIT-NEXT:  bb:
; TUNIT-NEXT:    call void @hoge() #[[ATTR2:[0-9]+]]
; TUNIT-NEXT:    unreachable
; TUNIT:       bb1:
; TUNIT-NEXT:    unreachable
; TUNIT:       bb2:
; TUNIT-NEXT:    unreachable
;
; CGSCC: Function Attrs: nofree noreturn nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@zot
; CGSCC-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    call void @hoge() #[[ATTR4:[0-9]+]]
; CGSCC-NEXT:    unreachable
; CGSCC:       bb1:
; CGSCC-NEXT:    unreachable
; CGSCC:       bb2:
; CGSCC-NEXT:    unreachable
;
bb:
  invoke void @hoge()
  to label %bb1 unwind label %bb2

bb1:
  unreachable

bb2:
  %tmp = landingpad { ptr, i32 }
  cleanup
  unreachable
}

define internal void @hoge() {
; TUNIT: Function Attrs: nofree norecurse noreturn nosync nounwind willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@hoge
; TUNIT-SAME: () #[[ATTR0]] {
; TUNIT-NEXT:  bb:
; TUNIT-NEXT:    unreachable
;
; CGSCC: Function Attrs: nofree noreturn nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@hoge
; CGSCC-SAME: () #[[ATTR0]] {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    unreachable
;
bb:
  %tmp = call fastcc ptr @spam(ptr @eggs)
  %tmp1 = call fastcc ptr @spam(ptr @barney)
  unreachable
}

define internal fastcc ptr @spam(ptr %arg) {
; CGSCC: Function Attrs: nofree norecurse noreturn nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@spam
; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    unreachable
;
bb:
  unreachable
}

define internal i1 @eggs(ptr %arg) {
; CGSCC-LABEL: define {{[^@]+}}@eggs
; CGSCC-SAME: (ptr [[ARG:%.*]]) {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    [[TMP:%.*]] = call zeroext i1 @barney()
; CGSCC-NEXT:    unreachable
;
bb:
  %tmp = call zeroext i1 @barney(ptr %arg)
  unreachable
}

define internal i1 @barney(ptr %arg) {
; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@barney
; CGSCC-SAME: () #[[ATTR2:[0-9]+]] {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    ret i1 undef
;
bb:
  ret i1 undef
}

define i32 @test_inf_promote_caller(i32 %arg) {
; TUNIT: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; TUNIT-LABEL: define {{[^@]+}}@test_inf_promote_caller
; TUNIT-SAME: (i32 [[ARG:%.*]]) #[[ATTR1:[0-9]+]] {
; TUNIT-NEXT:  bb:
; TUNIT-NEXT:    ret i32 0
;
; CGSCC: Function Attrs: nofree nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@test_inf_promote_caller
; CGSCC-SAME: (i32 [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    [[TMP:%.*]] = alloca [[S:%.*]], align 8
; CGSCC-NEXT:    [[TMP1:%.*]] = alloca [[S]], align 8
; CGSCC-NEXT:    ret i32 0
;
bb:
  %tmp = alloca %S
  %tmp1 = alloca %S
  %tmp2 = call i32 @test_inf_promote_callee(ptr %tmp, ptr %tmp1)

  ret i32 0
}

define internal i32 @test_inf_promote_callee(ptr %arg, ptr %arg1) {
; CGSCC: Function Attrs: nofree nosync nounwind willreturn memory(none)
; CGSCC-LABEL: define {{[^@]+}}@test_inf_promote_callee
; CGSCC-SAME: () #[[ATTR3]] {
; CGSCC-NEXT:  bb:
; CGSCC-NEXT:    ret i32 undef
;
bb:
  %tmp2 = load ptr, ptr %arg1
  %tmp4 = load ptr, ptr %arg
  %tmp5 = call i32 @test_inf_promote_callee(ptr %tmp4, ptr %tmp2)

  ret i32 0
}

declare i32 @wibble(...)
;.
; TUNIT: attributes #[[ATTR0]] = { nofree norecurse noreturn nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR2]] = { noreturn nounwind }
;.
; CGSCC: attributes #[[ATTR0]] = { nofree noreturn nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { nofree norecurse noreturn nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR4]] = { noreturn nounwind }
;.
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK: {{.*}}