1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Analysis/ScalarEvolution/exponential-behavior.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

59 lines
1.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
; CHECK: Printing analysis 'Scalar Evolution Analysis' for function 'f':
; CHECK: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
; CHECK: Loop %loop: max backedge-taken count is 0
; CHECK: Loop %loop: Unpredictable predicated backedge-taken count.
define void @f(i32 %n, i32* %ptr) {
entry:
br label %loop
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.inc, %be ]
%iv.inc = add i32 %iv, 1
%unswitch_cond_root = icmp ne i32 %iv.inc, 42
%us.0 = and i1 %unswitch_cond_root, %unswitch_cond_root
%us.1 = and i1 %us.0, %us.0
%us.2 = and i1 %us.1, %us.1
%us.3 = and i1 %us.2, %us.2
%us.4 = and i1 %us.3, %us.3
%us.5 = and i1 %us.4, %us.4
%us.6 = and i1 %us.5, %us.5
%us.7 = and i1 %us.6, %us.6
%us.8 = and i1 %us.7, %us.7
%us.9 = and i1 %us.8, %us.8
%us.10 = and i1 %us.9, %us.9
%us.11 = and i1 %us.10, %us.10
%us.12 = and i1 %us.11, %us.11
%us.13 = and i1 %us.12, %us.12
%us.14 = and i1 %us.13, %us.13
%us.15 = and i1 %us.14, %us.14
%us.16 = and i1 %us.15, %us.15
%us.17 = and i1 %us.16, %us.16
%us.18 = and i1 %us.17, %us.17
%us.19 = and i1 %us.18, %us.18
%us.20 = and i1 %us.19, %us.19
%us.21 = and i1 %us.20, %us.20
%us.22 = and i1 %us.21, %us.21
%us.23 = and i1 %us.22, %us.22
%us.24 = and i1 %us.23, %us.23
%us.25 = and i1 %us.24, %us.24
%us.26 = and i1 %us.25, %us.25
%us.27 = and i1 %us.26, %us.26
%us.28 = and i1 %us.27, %us.27
%us.29 = and i1 %us.28, %us.28
br i1 %us.29, label %leave, label %be
be:
store volatile i32 0, i32* %ptr
%becond = icmp ult i32 %iv.inc, %n
br i1 %becond, label %leave, label %loop
leave:
ret void
}