1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[SCEV] [NFC] add testcase for constant range for addrecexpr with nsw flag

This commit is contained in:
Zheng Chen 2020-01-09 01:24:22 -05:00
parent ca4fcd8faa
commit 4e5c39e80b

View File

@ -39,3 +39,22 @@ exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw
; CHECK: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,1) S: [-2147483648,1)
define void @test-addrec-nsw(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
}