1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/Analysis/ScalarEvolution/no-wrap-unknown-becount.ll
Arthur Eubanks 09cfe7939a [SCEV] Fix ScalarEvolution tests under NPM
Many tests use opt's -analyze feature, which does not translate well to
NPM and has better alternatives. The alternative here is to explicitly
add a pass that calls ScalarEvolution::print().

The legacy pass manager RUNs aren't changing, but they are now pinned to
the legacy pass manager.  For each legacy pass manager RUN, I added a
corresponding NPM RUN using the 'print<scalar-evolution>' pass. For
compatibility with update_analyze_test_checks.py and existing test
CHECKs, 'print<scalar-evolution>' now prints what -analyze prints per
function.

This was generated by the following Python script and failures were
manually fixed up:

import sys
for i in sys.argv:
    with open(i, 'r') as f:
        s = f.read()
    with open(i, 'w') as f:
        for l in s.splitlines():
            if "RUN:" in l and ' -analyze ' in l and '\\' not in l:
                f.write(l.replace(' -analyze ', ' -analyze -enable-new-pm=0 '))
                f.write('\n')
                f.write(l.replace(' -analyze ', ' -disable-output ').replace(' -scalar-evolution ', ' "-passes=print<scalar-evolution>" ').replace(" | ", " 2>&1 | "))
                f.write('\n')
            else:
                f.write(l)

There are a couple failures still in ScalarEvolution under NPM, but
those are due to other unrelated naming conflicts.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D83798
2020-07-16 11:24:07 -07:00

192 lines
4.7 KiB
LLVM

; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution < %s | FileCheck %s
; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
declare void @llvm.experimental.guard(i1, ...)
declare void @llvm.assume(i1)
define void @s_0(i32 %n, i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @s_0
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, 1
%iv.sext = sext i32 %iv to i64
; CHECK: %iv.sext = sext i32 %iv to i64
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop>
%cmp = icmp slt i32 %iv, %n
call void(i1, ...) @llvm.experimental.guard(i1 %cmp) [ "deopt"() ]
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @s_1(i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @s_1
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, 3
%iv.sext = sext i32 %iv to i64
; CHECK: %iv.sext = sext i32 %iv to i64
; CHECK-NEXT: --> {0,+,3}<nuw><nsw><%loop>
%cmp = icmp slt i32 %iv, 10000
call void(i1, ...) @llvm.experimental.guard(i1 %cmp) [ "deopt"() ]
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @s_2(i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @s_2
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, 3
%iv.sext = sext i32 %iv to i64
%cmp = icmp slt i32 %iv, 10000
; CHECK: %iv.sext = sext i32 %iv to i64
; CHECK-NEXT: --> {0,+,3}<nuw><nsw><%loop>
call void @llvm.assume(i1 %cmp)
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @s_3(i32 %start, i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @s_3
entry:
br label %loop
loop:
%iv = phi i32 [ %start, %entry ], [ %iv.inc, %be ]
%cmp = icmp slt i32 %iv, 10000
br i1 %cmp, label %be, label %leave
be:
%iv.inc = add i32 %iv, 3
%iv.inc.sext = sext i32 %iv.inc to i64
; CHECK: %iv.inc.sext = sext i32 %iv.inc to i64
; CHECK-NEXT: --> {(sext i32 (3 + %start) to i64),+,3}<nsw><%loop>
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @s_4(i32 %start, i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @s_4
entry:
br label %loop
loop:
%iv = phi i32 [ %start, %entry ], [ %iv.inc, %be ]
%cmp = icmp sgt i32 %iv, -1000
br i1 %cmp, label %be, label %leave
be:
%iv.inc = add i32 %iv, -3
%iv.inc.sext = sext i32 %iv.inc to i64
; CHECK: %iv.inc.sext = sext i32 %iv.inc to i64
; CHECK-NEXT: --> {(sext i32 (-3 + %start) to i64),+,-3}<nsw><%loop>
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @u_0(i32 %n, i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @u_0
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, 1
%iv.zext = zext i32 %iv to i64
; CHECK: %iv.zext = zext i32 %iv to i64
; CHECK-NEXT: --> {0,+,1}<nuw><%loop>
%cmp = icmp ult i32 %iv, %n
call void(i1, ...) @llvm.experimental.guard(i1 %cmp) [ "deopt"() ]
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @u_1(i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @u_1
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, 3
%iv.zext = zext i32 %iv to i64
; CHECK: %iv.zext = zext i32 %iv to i64
; CHECK-NEXT: --> {0,+,3}<nuw><%loop>
%cmp = icmp ult i32 %iv, 10000
call void(i1, ...) @llvm.experimental.guard(i1 %cmp) [ "deopt"() ]
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @u_2(i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @u_2
entry:
br label %loop
loop:
%iv = phi i32 [ 30000, %entry ], [ %iv.inc, %loop ]
%iv.inc = add i32 %iv, -2
%iv.zext = zext i32 %iv to i64
%cmp = icmp ugt i32 %iv.inc, -10000
; CHECK: %iv.zext = zext i32 %iv to i64
; CHECK-NEXT: --> {30000,+,-2}<nw><%loop>
call void @llvm.assume(i1 %cmp)
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}
define void @u_3(i32 %start, i1* %cond) {
; CHECK-LABEL: Classifying expressions for: @u_3
entry:
br label %loop
loop:
%iv = phi i32 [ %start, %entry ], [ %iv.inc, %be ]
%cmp = icmp ult i32 %iv, 10000
br i1 %cmp, label %be, label %leave
be:
%iv.inc = add i32 %iv, 3
%iv.inc.zext = zext i32 %iv.inc to i64
; CHECK: %iv.inc.zext = zext i32 %iv.inc to i64
; CHECK-NEXT: --> {(zext i32 (3 + %start) to i64),+,3}<nuw><%loop>
%c = load volatile i1, i1* %cond
br i1 %c, label %loop, label %leave
leave:
ret void
}