• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -scalar-evolution -analyze | grep {Loop %bb: backedge-taken count is (-1 + (-1 \\* %x) + %y)}
2; PR1597
3
4define i32 @f(i32 %x, i32 %y) {
5entry:
6        %tmp63 = icmp ult i32 %x, %y            ; <i1> [#uses=1]
7        br i1 %tmp63, label %bb.preheader, label %bb8
8
9bb.preheader:           ; preds = %entry
10        br label %bb
11
12bb:             ; preds = %bb3, %bb.preheader
13        %x_addr.0 = phi i32 [ %tmp2, %bb3 ], [ %x, %bb.preheader ]              ; <i32> [#uses=1]
14        %tmp2 = add i32 %x_addr.0, 1            ; <i32> [#uses=3]
15        br label %bb3
16
17bb3:            ; preds = %bb
18        %tmp6 = icmp ult i32 %tmp2, %y          ; <i1> [#uses=1]
19        br i1 %tmp6, label %bb, label %bb8.loopexit
20
21bb8.loopexit:           ; preds = %bb3
22        br label %bb8
23
24bb8:            ; preds = %bb8.loopexit, %entry
25        %x_addr.1 = phi i32 [ %x, %entry ], [ %tmp2, %bb8.loopexit ]            ; <i32> [#uses=1]
26        br label %return
27
28return:         ; preds = %bb8
29        ret i32 %x_addr.1
30}
31