source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/ScalarEvolution/non-IV-phi.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.4 KB
Line 
1; RUN: opt -scalar-evolution -analyze < %s | FileCheck %s
2
3define void @test1(i8 %t, i32 %len) {
4; CHECK-LABEL: test1
5; CHECK: %sphi = phi i32 [ %ext, %entry ], [ %idx.inc.ext, %loop ]
6; CHECK-NEXT:  -->  (zext i8 {%t,+,1}<%loop> to i32)
7
8 entry:
9  %st = zext i8 %t to i16
10  %ext = zext i8 %t to i32
11  %ecmp = icmp ult i16 %st, 42
12  br i1 %ecmp, label %loop, label %exit
13
14 loop:
15
16  %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ]
17  %sphi = phi i32 [ %ext, %entry ], [%idx.inc.ext, %loop]
18
19  %idx.inc = add i8 %idx, 1
20  %idx.inc.ext = zext i8 %idx.inc to i32
21  %idx.ext = zext i8 %idx to i32
22
23  %c = icmp ult i32 %idx.inc.ext, %len
24  br i1 %c, label %loop, label %exit
25
26 exit:
27  ret void
28}
29
30define void @test2(i8 %t, i32 %len) {
31; CHECK-LABEL: test2
32; CHECK: %sphi = phi i32 [ %ext.mul, %entry ], [ %mul, %loop ]
33; CHECK-NEXT:  -->  (4 * (zext i8 {%t,+,1}<%loop> to i32))
34
35 entry:
36  %st = zext i8 %t to i16
37  %ext = zext i8 %t to i32
38  %ext.mul = mul i32 %ext, 4
39
40  %ecmp = icmp ult i16 %st, 42
41  br i1 %ecmp, label %loop, label %exit
42
43 loop:
44
45  %idx = phi i8 [ %t, %entry ], [ %idx.inc, %loop ]
46  %sphi = phi i32 [ %ext.mul, %entry ], [%mul, %loop]
47
48  %idx.inc = add i8 %idx, 1
49  %idx.inc.ext = zext i8 %idx.inc to i32
50  %mul = mul i32 %idx.inc.ext, 4
51
52  %idx.ext = zext i8 %idx to i32
53
54  %c = icmp ult i32 %idx.inc.ext, %len
55  br i1 %c, label %loop, label %exit
56
57 exit:
58  ret void
59}
Note: See TracBrowser for help on using the repository browser.