• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -analyze -iv-users | grep {\{1,+,3,+,2\}<%loop> (post-inc with loop %loop)}
2
3; The value of %r is dependent on a polynomial iteration expression.
4
5define i64 @foo(i64 %n) {
6entry:
7  br label %loop
8
9loop:
10  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %loop ]
11  %indvar.next = add i64 %indvar, 1
12  %c = icmp eq i64 %indvar.next, %n
13  br i1 %c, label %exit, label %loop
14
15exit:
16  %r = mul i64 %indvar.next, %indvar.next
17  ret i64 %r
18}
19