Skip to content

Commit 54385f5

Browse files
authored
llvm-reduce: Increase operands-to-args test coverage (#133853)
This wasn't checking the output for all functions. --match-full-lines is also particularly hazardous for the interestingness checks for avoiding asserts and broken IR. Also add tests for some of the filtered function user types. This wasn't covered, and is overly conservative.
1 parent e0f8898 commit 54385f5

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

llvm/test/tools/llvm-reduce/operands-to-args.ll

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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
33

4+
; INTERESTING-LABEL: define void @func(
45
; REDUCED-LABEL: define void @func(i32 %k, ptr %Local, ptr %Global) {
56

67
; Keep one reference to the original value.
@@ -19,9 +20,6 @@
1920
; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21
2021
; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4
2122

22-
; INTERESTING-LABEL: define void @func_caller() {
23-
; REDUCED: call void @func(i32 21, ptr null, ptr null)
24-
2523

2624
@Global = global i32 42
2725
@GlobalKeep = global i32 42
@@ -47,7 +45,9 @@ entry:
4745
ret void
4846
}
4947

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)
5151
define void @func_caller() {
5252
entry:
5353
call void @func(i32 21)
@@ -58,14 +58,61 @@ entry:
5858
; Make sure to skip functions with non-direct call users
5959
declare void @e(ptr)
6060

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)
6264
define void @g() {
6365
call void @e(ptr @f)
6466
ret void
6567
}
6668

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
6872
define void @f(ptr %a) {
6973
%1 = load ptr, ptr %a
7074
ret void
7175
}
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

Comments
 (0)