1
- ; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg -- check-prefix=INTERESTING --test-arg --input-file
2
- ; RUN: FileCheck %s --input-file %t --check-prefixes =REDUCED,INTERESTING
1
+ ; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=operands-to-args --test FileCheck --test-arg %s --test-arg --check-prefix=INTERESTING --test-arg --input-file
2
+ ; RUN: FileCheck %s --input-file %t --check-prefix =REDUCED
3
3
4
+ ; INTERESTING-LABEL: define void @func(
4
5
; REDUCED-LABEL: define void @func(i32 %k, ptr %Local, ptr %Global) {
5
6
6
7
; Keep one reference to the original value.
19
20
; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21
20
21
; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4
21
22
22
- ; INTERESTING-LABEL: define void @func_caller() {
23
- ; REDUCED: call void @func(i32 21, ptr null, ptr null)
24
-
25
23
26
24
@Global = global i32 42
27
25
@GlobalKeep = global i32 42
47
45
ret void
48
46
}
49
47
50
-
48
+ ; INTERESTING-LABEL: define void @func_caller(
49
+ ; REDUCED-LABEL: define void @func_caller() {
50
+ ; REDUCED: call void @func(i32 21, ptr null, ptr null)
51
51
define void @func_caller () {
52
52
entry:
53
53
call void @func (i32 21 )
@@ -58,14 +58,61 @@ entry:
58
58
; Make sure to skip functions with non-direct call users
59
59
declare void @e (ptr )
60
60
61
- ; INTERESTING-LABEL: define void @g() {
61
+ ; INTERESTING-LABEL: define void @g(
62
+ ; REDUCED-LABEL: define void @g(ptr %f) {
63
+ ; REDUCED: call void @e(ptr %f)
62
64
define void @g () {
63
65
call void @e (ptr @f )
64
66
ret void
65
67
}
66
68
67
- ; INTERESTING-LABEL: define void @f(ptr %a) {
69
+ ; INTERESTING-LABEL: define void @f(
70
+ ; REDUCED-LABEL: define void @f(ptr %a) {
71
+ ; REDUCED: %1 = load ptr, ptr %a, align 8
68
72
define void @f (ptr %a ) {
69
73
%1 = load ptr , ptr %a
70
74
ret void
71
75
}
76
+
77
+ @gv_init_use = global [1 x ptr ] [ptr @has_global_init_user ]
78
+
79
+ ; INTERESTING-LABEL: define void @has_global_init_user(
80
+ ; REDUCED-LABEL: define void @has_global_init_user() {
81
+ define void @has_global_init_user () {
82
+ %Local = alloca i32 , align 4
83
+ store i32 42 , ptr %Local , align 4
84
+ ret void
85
+ }
86
+
87
+ ; INTERESTING-LABEL: define void @has_callee_and_arg_user(
88
+ ; REDUCED-LABEL: define void @has_callee_and_arg_user(ptr %orig.arg) {
89
+ define void @has_callee_and_arg_user (ptr %orig.arg ) {
90
+ %Local = alloca i32 , align 4
91
+ store i32 42 , ptr %Local , align 4
92
+ ret void
93
+ }
94
+
95
+ declare void @ptr_user (ptr )
96
+
97
+ ; INTERESTING-LABEL: define void @calls_and_passes_func(
98
+ ; REDUCED-LABEL: define void @calls_and_passes_func(ptr %has_callee_and_arg_user) {
99
+ ; REDUCED: call void @has_callee_and_arg_user(ptr %has_callee_and_arg_user)
100
+ define void @calls_and_passes_func () {
101
+ call void @has_callee_and_arg_user (ptr @has_callee_and_arg_user )
102
+ ret void
103
+ }
104
+
105
+ ; INTERESTING-LABEL: define void @has_wrong_callsite_type_user(
106
+ ; REDUCED-LABEL: define void @has_wrong_callsite_type_user(i32 %extra.arg, ptr %Local) {
107
+ define void @has_wrong_callsite_type_user (i32 %extra.arg ) {
108
+ %Local = alloca i32 , align 4
109
+ store i32 42 , ptr %Local , align 4
110
+ ret void
111
+ }
112
+
113
+ ; INTERESTING-LABEL: define void @calls_wrong_func_type(
114
+ ; REDUCED: call void @has_wrong_callsite_type_user()
115
+ define void @calls_wrong_func_type () {
116
+ call void @has_wrong_callsite_type_user ()
117
+ ret void
118
+ }
0 commit comments