xref: /llvm-project/llvm/test/tools/llvm-reduce/reduce-operands-ptr.ll (revision a946eb160a45d1761536b8782a6de8afae87cc51)
1; Test that llvm-reduce can reduce pointer operands
2; 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
3; RUN: FileCheck --check-prefixes=CHECK,ONE %s < %t
4
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: FileCheck --check-prefixes=CHECK,ZERO %s < %t
7
8; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
9; RUN: FileCheck --check-prefixes=CHECK,ZERO %s < %t
10
11; CHECK-LABEL: define void @foo(
12
13; ONE: load i32, ptr %a0
14; ONE: load i32, ptr @g
15; ONE: extractelement <4 x ptr> <ptr @g, ptr null, ptr @g, ptr @g>, i32 11
16
17; ZERO: load i32, ptr null
18; ZERO: load i32, ptr null
19; ZERO: extractelement <4 x ptr> zeroinitializer, i32 11
20
21@g = global i32 0
22
23define void @foo(ptr %a0) {
24  ; CHECK-INTERESTINGNESS: load i32
25  %v0 = load i32, ptr %a0
26  ; CHECK-INTERESTINGNESS: load i32
27  %v1 = load i32, ptr @g
28
29  ; CHECK-INTERESTINGNESS: extractelement{{.*}}i32 11
30  %v2 = extractelement <4 x ptr> <ptr @g, ptr null, ptr @g, ptr @g>, i32 11
31
32  ret void
33}
34