xref: /llvm-project/llvm/test/tools/llvm-reduce/reduce-operands.ll (revision 4982d8ac7694591d541492faac0f6d9091a18540)
1; Test that llvm-reduce can reduce operands
2;
3; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
4; RUN: cat %t | FileCheck %s --check-prefixes=CHECK,ONE
5; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-zero --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
6; RUN: cat %t | FileCheck %s --check-prefixes=CHECK,ZERO
7; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
8; RUN: cat %t | FileCheck %s --check-prefixes=CHECK,ZERO
9
10; CHECK-INTERESTINGNESS: inttoptr
11; CHECK-INTERESTINGNESS: inttoptr
12; CHECK-INTERESTINGNESS: inttoptr
13; CHECK-INTERESTINGNESS: inttoptr
14; CHECK-INTERESTINGNESS: br label
15; CHECK-INTERESTINGNESS: ret i32
16
17%t = type { i32, i8 }
18
19declare void @llvm.foo(metadata)
20
21; CHECK-LABEL: define i32 @main
22define i32 @main(ptr %a, i32 %a2) {
23
24; CHECK-LABEL: lb1:
25; ONE: inttoptr i16 0
26; ONE: inttoptr i16 1
27; ONE: inttoptr i16 1
28; ONE: inttoptr i16 1
29; ZERO: inttoptr i16 0
30; ZERO: inttoptr i16 0
31; ZERO: inttoptr i16 0
32; ZERO: inttoptr i16 0
33; CHECK: br label %lb2
34lb1:
35  %b = getelementptr %t, ptr %a, i32 1, i32 0
36  %i1 = inttoptr i16 0 to ptr
37  %i2 = inttoptr i16 1 to ptr
38  %i3 = inttoptr i16 2 to ptr
39  %i4 = inttoptr i16 undef to ptr
40  call void @llvm.foo(metadata ptr %a)
41  br label %lb2
42
43; CHECK-LABEL: lb2:
44; ONE: ret i32 1
45; ZERO: ret i32 0
46lb2:
47  ret i32 %a2
48}
49