1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Analysis/ScalarEvolution/trip-count6.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

47 lines
1.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution -scalar-evolution-classify-expressions=0 | FileCheck %s
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1]
define i8 @f() {
; CHECK-LABEL: 'f'
; CHECK-NEXT: Determining loop execution counts for: @f
; CHECK-NEXT: Loop %bb: <multiple exits> Unpredictable backedge-taken count.
; CHECK-NEXT: exit count for bb: ***COULDNOTCOMPUTE***
; CHECK-NEXT: exit count for bb2: 1
; CHECK-NEXT: Loop %bb: max backedge-taken count is 1
; CHECK-NEXT: Loop %bb: Unpredictable predicated backedge-taken count.
;
entry:
tail call i32 @fegetround( ) ; <i32>:0 [#uses=1]
br label %bb
bb: ; preds = %bb4, %entry
%mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; <i8> [#uses=4]
zext i8 %mode.0 to i32 ; <i32>:1 [#uses=1]
getelementptr [4 x i32], [4 x i32]* @mode_table, i32 0, i32 %1 ; <i32*>:2 [#uses=1]
load i32, i32* %2, align 4 ; <i32>:3 [#uses=1]
icmp eq i32 %3, %0 ; <i1>:4 [#uses=1]
br i1 %4, label %bb1, label %bb2
bb1: ; preds = %bb
ret i8 %mode.0
bb2: ; preds = %bb
icmp eq i8 %mode.0, 1 ; <i1>:5 [#uses=1]
br i1 %5, label %bb5, label %bb4
bb4: ; preds = %bb2
%indvar.next = add i8 %mode.0, 1 ; <i8> [#uses=1]
br label %bb
bb5: ; preds = %bb2
tail call void @raise_exception( ) noreturn
unreachable
}
declare i32 @fegetround()
declare void @raise_exception() noreturn