Skip to content

Commit

Permalink
[SCEV] add testcase for get accurate range for addrecexpr with nuw flag
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzheng1030 committed Dec 23, 2019
1 parent 2539cd2 commit 7259f04
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
Expand Up @@ -19,3 +19,23 @@ exit:
ret void
}

; CHECK-LABEL: @test-addrec-nuw
; CHECK: --> {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> U: full-set S: full-set
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
}

0 comments on commit 7259f04

Please sign in to comment.