1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Analysis/ScalarEvolution/2008-06-12-BinomialInt64.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

45 lines
1.6 KiB
LLVM

; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution 2>/dev/null
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>/dev/null
; PR2433
define i32 @main1(i32 %argc, i8** %argv) nounwind {
entry:
br i1 false, label %bb10, label %bb23
bb10: ; preds = %bb10, %entry
%accum.03 = phi i64 [ %tmp14, %bb10 ], [ 0, %entry ] ; <i64> [#uses=1]
%i.02 = phi i32 [ %tmp16, %bb10 ], [ 0, %entry ] ; <i32> [#uses=1]
%d.1.01 = phi i64 [ %tmp5.i, %bb10 ], [ 0, %entry ] ; <i64> [#uses=1]
%tmp5.i = add i64 %d.1.01, 1 ; <i64> [#uses=2]
%tmp14 = add i64 %accum.03, %tmp5.i ; <i64> [#uses=2]
%tmp16 = add i32 %i.02, 1 ; <i32> [#uses=2]
%tmp20 = icmp slt i32 %tmp16, 0 ; <i1> [#uses=1]
br i1 %tmp20, label %bb10, label %bb23
bb23: ; preds = %bb10, %entry
%accum.0.lcssa = phi i64 [ 0, %entry ], [ %tmp14, %bb10 ] ; <i64> [#uses=0]
ret i32 0
}
define i32 @main2(i32 %argc, i8** %argv) {
entry:
%tmp8 = tail call i32 @atoi( i8* null ) nounwind readonly ; <i32> [#uses=1]
br i1 false, label %bb9, label %bb21
bb9: ; preds = %bb9, %entry
%accum.03 = phi i64 [ %tmp12, %bb9 ], [ 0, %entry ] ; <i64> [#uses=1]
%i.02 = phi i32 [ %tmp14, %bb9 ], [ 0, %entry ] ; <i32> [#uses=1]
%d.1.01 = phi i64 [ %tmp4.i, %bb9 ], [ 0, %entry ] ; <i64> [#uses=1]
%tmp4.i = add i64 %d.1.01, 1 ; <i64> [#uses=2]
%tmp12 = add i64 %accum.03, %tmp4.i ; <i64> [#uses=2]
%tmp14 = add i32 %i.02, 1 ; <i32> [#uses=2]
%tmp18 = icmp slt i32 %tmp14, %tmp8 ; <i1> [#uses=1]
br i1 %tmp18, label %bb9, label %bb21
bb21: ; preds = %bb9, %entry
%accum.0.lcssa = phi i64 [ 0, %entry ], [ %tmp12, %bb9 ] ; <i64> [#uses=0]
ret i32 0
}
declare i32 @atoi(i8*) nounwind readonly