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
123 lines
4.1 KiB
LLVM
123 lines
4.1 KiB
LLVM
; RUN: opt < %s -S -analyze -enable-new-pm=0 -scalar-evolution | FileCheck %s
|
|
; RUN: opt < %s -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
|
|
|
|
; copied from flags-from-poison.ll
|
|
; CHECK-LABEL: @test-add-nuw
|
|
; CHECK: --> {(1 + %offset)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0)
|
|
define void @test-add-nuw(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nuw i32 %i, 1
|
|
%index32 = add nuw i32 %nexti, %offset
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: @test-addrec-nuw
|
|
; CHECK: --> {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> U: [11,0) S: [11,0)
|
|
define void @test-addrec-nuw(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
%cmp = icmp sgt i32 %offset, 10
|
|
%min.10 = select i1 %cmp, i32 %offset, i32 10
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nuw i32 %i, 1
|
|
%index32 = add nuw i32 %nexti, %min.10
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-neg
|
|
; CHECK: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,-10) S: [-2147483648,-10)
|
|
define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
%cmp = icmp slt i32 %offset, -10
|
|
%max = select i1 %cmp, i32 %offset, i32 -10
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nsw i32 %i, -1
|
|
%index32 = add nsw i32 %nexti, %max
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-neg
|
|
; CHECK: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,10) S: [-2147483648,10)
|
|
define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
%cmp = icmp slt i32 %offset, 10
|
|
%max = select i1 %cmp, i32 %offset, i32 10
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nsw i32 %i, -1
|
|
%index32 = add nsw i32 %nexti, %max
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-pos
|
|
; CHECK: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [11,-2147483648) S: [11,-2147483648)
|
|
define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
%cmp = icmp sgt i32 %offset, 10
|
|
%min = select i1 %cmp, i32 %offset, i32 10
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nsw i32 %i, 1
|
|
%index32 = add nsw i32 %nexti, %min
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-pos
|
|
; CHECK: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: [-9,-2147483648) S: [-9,-2147483648)
|
|
define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
|
|
entry:
|
|
%cmp = icmp sgt i32 %offset, -10
|
|
%min = select i1 %cmp, i32 %offset, i32 -10
|
|
br label %loop
|
|
loop:
|
|
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
|
|
%nexti = add nsw i32 %i, 1
|
|
%index32 = add nsw i32 %nexti, %min
|
|
%ptr = getelementptr inbounds float, float* %input, i32 %index32
|
|
%f = load float, float* %ptr, align 4
|
|
%exitcond = icmp eq i32 %nexti, %numIterations
|
|
br i1 %exitcond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|