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