llvm.org GIT mirror llvm / 495d206
rename instcombine test file. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298904 91177308-0d34-0410-b5e6-96231b3b80d8 Anna Thomas 3 years ago
2 changed file(s) with 57 addition(s) and 57 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -S -instcombine | FileCheck %s
1 @A = extern_weak global i32, align 4
2 @B = extern_weak global i32, align 4
3
4 define i32 @foo(i1 %which) {
5 entry:
6 br i1 %which, label %final, label %delay
7
8 delay:
9 br label %final
10
11 ; CHECK-LABEL: @foo
12 ; CHECK-LABEL: final:
13 ; CHECK: phi i32 [ 1, %entry ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), %delay ]
14 final:
15 %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
16 %value = select i1 %use2, i32 2, i32 1
17 ret i32 %value
18 }
19
20
21 ; test folding of select into phi for vectors.
22 define <4 x i64> @vec1(i1 %which) {
23 entry:
24 br i1 %which, label %final, label %delay
25
26 delay:
27 br label %final
28
29 final:
30 ; CHECK-LABEL: @vec1
31 ; CHECK-LABEL: final:
32 ; CHECK: %phinode = phi <4 x i64> [ zeroinitializer, %entry ], [ , %delay ]
33 ; CHECK-NOT: select
34 ; CHECK: ret <4 x i64> %phinode
35 %phinode = phi <4 x i1> [ , %entry ], [ , %delay ]
36 %sel = select <4 x i1> %phinode, <4 x i64> zeroinitializer, <4 x i64>
37 ret <4 x i64> %sel
38 }
39
40 define <4 x i64> @vec2(i1 %which) {
41 entry:
42 br i1 %which, label %final, label %delay
43
44 delay:
45 br label %final
46
47 final:
48 ; CHECK-LABEL: @vec2
49 ; CHECK-LABEL: final:
50 ; CHECK: %phinode = phi <4 x i64> [ , %entry ], [ , %delay ]
51 ; CHECK-NOT: select
52 ; CHECK: ret <4 x i64> %phinode
53 %phinode = phi <4 x i1> [ , %entry ], [ , %delay ]
54 %sel = select <4 x i1> %phinode, <4 x i64> zeroinitializer, <4 x i64>
55 ret <4 x i64> %sel
56 }
+0
-57
test/Transforms/InstCombine/phi-select-constexpr.ll less more
None ; RUN: opt < %s -S -instcombine | FileCheck %s
1 @A = extern_weak global i32, align 4
2 @B = extern_weak global i32, align 4
3
4 define i32 @foo(i1 %which) {
5 entry:
6 br i1 %which, label %final, label %delay
7
8 delay:
9 br label %final
10
11 ; CHECK-LABEL: @foo
12 ; CHECK-LABEL: final:
13 ; CHECK: phi i32 [ 1, %entry ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), %delay ]
14 final:
15 %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
16 %value = select i1 %use2, i32 2, i32 1
17 ret i32 %value
18 }
19
20
21 ; test folding of select into phi for vectors.
22 define <4 x i64> @vec1(i1 %which) {
23 entry:
24 br i1 %which, label %final, label %delay
25
26 delay:
27 br label %final
28
29 final:
30 ; CHECK-LABEL: @vec1
31 ; CHECK-LABEL: final:
32 ; CHECK: %phinode = phi <4 x i64> [ zeroinitializer, %entry ], [ , %delay ]
33 ; CHECK-NOT: select
34 ; CHECK: ret <4 x i64> %phinode
35 %phinode = phi <4 x i1> [ , %entry ], [ , %delay ]
36 %sel = select <4 x i1> %phinode, <4 x i64> zeroinitializer, <4 x i64>
37 ret <4 x i64> %sel
38 }
39
40 define <4 x i64> @vec2(i1 %which) {
41 entry:
42 br i1 %which, label %final, label %delay
43
44 delay:
45 br label %final
46
47 final:
48 ; CHECK-LABEL: @vec2
49 ; CHECK-LABEL: final:
50 ; CHECK: %phinode = phi <4 x i64> [ , %entry ], [ , %delay ]
51 ; CHECK-NOT: select
52 ; CHECK: ret <4 x i64> %phinode
53 %phinode = phi <4 x i1> [ , %entry ], [ , %delay ]
54 %sel = select <4 x i1> %phinode, <4 x i64> zeroinitializer, <4 x i64>
55 ret <4 x i64> %sel
56 }