Skip to content

Commit d588a00

Browse files
author
czhengsz
committed
[SCEV] NFC - add testcase for get accurate range for AddExpr
1 parent 18188a7 commit d588a00

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: opt < %s -S -analyze -scalar-evolution | FileCheck %s
2+
3+
; copied from flags-from-poison.ll
4+
; CHECK-LABEL: @test-add-nuw
5+
; CHECK: --> {(1 + %offset)<nuw>,+,1}<nuw><%loop> U: full-set S: full-set
6+
define void @test-add-nuw(float* %input, i32 %offset, i32 %numIterations) {
7+
entry:
8+
br label %loop
9+
loop:
10+
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
11+
%nexti = add nuw i32 %i, 1
12+
%index32 = add nuw i32 %nexti, %offset
13+
%ptr = getelementptr inbounds float, float* %input, i32 %index32
14+
%f = load float, float* %ptr, align 4
15+
%exitcond = icmp eq i32 %nexti, %numIterations
16+
br i1 %exitcond, label %exit, label %loop
17+
18+
exit:
19+
ret void
20+
}
21+

0 commit comments

Comments
 (0)