source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/ValueTracking/monotonic-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.0 KB
Line 
1; RUN: opt -instsimplify -S < %s | FileCheck %s
2
3; CHECK-LABEL: @test1
4define i1 @test1(i8 %p, i8* %pq, i8 %n, i8 %r) {
5entry:
6  br label %loop
7loop:
8  %A = phi i8 [ 1, %entry ], [ %next, %loop ]
9  %next = add nsw i8 %A, 1
10  %cmp1 = icmp eq i8 %A, %n
11  br i1 %cmp1, label %exit, label %loop
12exit:
13  %add = or i8 %A, %r
14  %cmp = icmp eq i8 %add, 0
15  ; CHECK: ret i1 false
16  ret i1 %cmp
17}
18
19; CHECK-LABEL: @test2
20define i1 @test2(i8 %p, i8* %pq, i8 %n, i8 %r) {
21entry:
22  br label %loop
23loop:
24  %A = phi i8 [ 1, %entry ], [ %next, %loop ]
25  %next = add i8 %A, 1
26  %cmp1 = icmp eq i8 %A, %n
27  br i1 %cmp1, label %exit, label %loop
28exit:
29  %add = or i8 %A, %r
30  %cmp = icmp eq i8 %add, 0
31  ; CHECK-NOT: ret i1 false
32  ret i1 %cmp
33}
34
35; CHECK-LABEL: @test3
36define i1 @test3(i8 %p, i8* %pq, i8 %n, i8 %r) {
37entry:
38  br label %loop
39loop:
40  %A = phi i8 [ 1, %entry ], [ %next, %loop ]
41  %next = add nuw i8 %A, 1
42  %cmp1 = icmp eq i8 %A, %n
43  br i1 %cmp1, label %exit, label %loop
44exit:
45  %add = or i8 %A, %r
46  %cmp = icmp eq i8 %add, 0
47  ; CHECK: ret i1 false
48  ret i1 %cmp
49}
Note: See TracBrowser for help on using the repository browser.