• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
2
3; This loop has no preheader, multiple backedges, etc., but ScalarEvolution
4; should still be able to analyze it.
5
6; CHECK: %i = phi i64 [ 5, %entry ], [ 5, %alt ], [ %i.next, %loop.a ], [ %i.next, %loop.b ]
7; CHECK-NEXT: -->  {5,+,1}<%loop>
8
9define void @foo(i1 %p, i1 %q, i1 %s, i1 %u) {
10entry:
11  br i1 %p, label %loop, label %alt
12
13alt:
14  br i1 %s, label %loop, label %exit
15
16loop:
17  %i = phi i64 [ 5, %entry ], [ 5, %alt ], [ %i.next, %loop.a ], [ %i.next, %loop.b ]
18  %i.next = add i64 %i, 1
19  br i1 %q, label %loop.a, label %loop.b
20
21loop.a:
22  br label %loop
23
24loop.b:
25  br i1 %u, label %loop, label %exit
26
27exit:
28  ret void
29}
30