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
41 lines
985 B
LLVM
41 lines
985 B
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
|
|
|
|
define void @x(i1* %cond) {
|
|
; CHECK-LABEL: Classifying expressions for: @x
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
|
|
; CHECK: %idx = phi i8 [ 0, %entry ], [ %idx.inc, %loop ]
|
|
; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-128) S: [0,-128)
|
|
|
|
%idx.inc = add nsw i8 %idx, 1
|
|
|
|
%c = load volatile i1, i1* %cond
|
|
br i1 %c, label %loop, label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
define void @y(i8* %addr) {
|
|
; CHECK-LABEL: Classifying expressions for: @y
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%idx = phi i8 [-5, %entry ], [ %idx.inc, %loop ]
|
|
; CHECK: %idx = phi i8 [ -5, %entry ], [ %idx.inc, %loop ]
|
|
; CHECK-NEXT: --> {-5,+,1}<%loop> U: [-5,6) S: [-5,6)
|
|
|
|
%idx.inc = add i8 %idx, 1
|
|
|
|
%continue = icmp slt i8 %idx.inc, 6
|
|
br i1 %continue, label %loop, label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|