xref: /llvm-project/llvm/test/tools/llvm-reduce/reduce-attributes-optnone-noinline.ll (revision 7cd0fd6f519558fcccf07d7cbf14237f2c5182fe)
1; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=attributes --test FileCheck --test-arg -check-prefixes=INTERESTING,INTERESTING-NOINLINE --test-arg %s --test-arg --input-file %s -o %t.0
2; RUN: FileCheck --check-prefix=RESULT-NOINLINE %s < %t.0
3
4; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=attributes --test FileCheck --test-arg -check-prefixes=INTERESTING,INTERESTING-OPTNONE --test-arg %s --test-arg --input-file %s -o %t.1
5; RUN: FileCheck --check-prefix=RESULT-OPTNONE %s < %t.1
6
7
8; Make sure this doesn't hit the "Attribute 'optnone' requires
9; 'noinline'!" verifier error. optnone can be dropped separately from
10; noinline, but removing noinline requires removing the pair together.
11
12
13; INTERESTING: @keep_func() [[KEEP_ATTRS:#[0-9]+]]
14; RESULT-NOINLINE: define void @keep_func() [[KEEP_ATTRS:#[0-9]+]] {
15; RESULT-OPTNONE: define void @keep_func() [[KEEP_ATTRS:#[0-9]+]] {
16define void @keep_func() #0 {
17  ret void
18}
19
20; Both should be removed together
21; INTERESTING: @drop_func()
22; RESULT-NOINLINE: define void @drop_func() {
23; RESULT-OPTNONE: define void @drop_func() {
24define void @drop_func() #0 {
25  ret void
26}
27
28; RESULT-NOINLINE: attributes [[KEEP_ATTRS]] = { noinline }
29; RESULT-OPTNONE: attributes [[KEEP_ATTRS]] = { noinline optnone }
30
31
32; INTERESTING-NOINLINE: attributes [[KEEP_ATTRS]] =
33; INTERESTING-NOINLINE-SAME: noinline
34
35; INTERESTING-OPTNONE: attributes [[KEEP_ATTRS]] =
36; INTERESTING-OPTNONE-SAME: optnone
37
38attributes #0 = { noinline optnone }
39